Results 1 to 3 of 3

Thread: Questions about code for the system caret and keyboard language

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    54

    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!

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    54

    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
  •  



Click Here to Expand Forum to Full Width