|
-
Oct 19th, 2012, 03:47 AM
#1
Thread Starter
Member
Questions about code for the system caret and keyboard language
Hi,
I was wandering if I can affect the color or shapes of the caret of any text box system wide.
I noticed that the caret looks different in every program, and varies even more in some websites.
So my main question is, does all text box carets have the same handle? can I affect them all globally?
And if so, how can I perhaps change the caret's color, or add a bitmap/color overlay to it, in vb.net (i'm using vs express 2012) ?
The purpose is to change the color of the caret based on the current keyboard language (for systems with 2 or more languages), as an indicator, so you will always know via the caret color, what is the current language.
I also didn't find a way to detect the current language in vb.net, so I would appreciate some help with that also.
Up until now I was programming with VB6, and I found online how to do this with it, but I want to move to .NET and the transitioning isn't so simple for me...
I hope I managed to explain myself.
Thanks!
-
Oct 19th, 2012, 07:43 AM
#2
Re: Questions about code for the system caret and keyboard language
It can be changed globally by changing your mouse pointer settings in your Windows Control Panel...
that should be what all text boxes and any place where you type text should be using... BUT... on an individual basis, it *is* possible to set the MousePointer (or it might be MouseIcon, or MouseSomething) on a text box in an app YOU are creating to use something different. ... but that doesn't affect things globally... only the system can (and should) do that... so if you're seeing something different than what the system says the text cursor should be... then it's because the developer of that app overrode the settings for something else different.
-tg
-
Oct 19th, 2012, 08:59 AM
#3
Thread Starter
Member
Re: Questions about code for the system caret and keyboard language
That's too bad.
I was able to get exactly what I want to work within my program in vb6, using the following APIs:
Code:
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public Declare Function ActivateKeyboardLayout Lib _
"user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long
Public Declare Function GetKeyboardLayoutList Lib "User32" _
(ByVal nBuff As Long, lpList As Any) As Long
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As Long
And
Code:
Public Declare Function CreateCaret Lib "User32" (ByVal hWnd As Long, ByVal hBitmap As Long, ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function SetCaretPos Lib "User32" (ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function ShowCaret Lib "User32" (ByVal hWnd As Long) As Long
Public Declare Function DestroyCaret Lib "User32" () As Long
But, I was hoping to create an app that can sit in the background and help you see what language you are currntly using, right inside your current text box, no matter what program you are currently typing in, by overlaying the caret.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|