[AccessD] Cursor Color

Bobby Heid bheid at appdevgrp.com
Wed Feb 23 09:16:33 CST 2005


Mark,

>From the little research I just did, it looks like you could use the
ShowCaret/HideCaret and GotFocus APIs.  You have to use the GotFocus API
call to return the handle of the object that has the focus.  This is because
many of the controls in Access do not have a 
hWnd property.

>From what I have found, you first set the focus (may work if you do this
after the gotfocus event) to the text box.  The you call the GotFocus API
call to return the handle.

So maybe something like this (assuming we are in the gotfocus event):

'API definitions
Public Declare Function GetFocus Lib "user" () As Long 
Private Declare Function HideCaret Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long

dim hWnd as long	

hWnd=GotFocus()	'get the handle of the text box (really whatever has the
focus)
HideCaret hWnd


If you wanted to set the focus yourself, use textbox.setfocus before calling
the above GotFocus API function.

I think in your example you would want to turn off the cursor in the
gotfocus event and turn it back on in the lostfocus event.  I think that
windows wants to keep turning it back on (such as if you click in the text
box again after gotfocus, so you may have to turn it off based upon several
events.  You will just have to play with it.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Wednesday, February 23, 2005 9:11 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Cursor Color


Hello All,

Any ideas on this one?

>
>When a text box gets focus...the cursor blinks a different
>color...regardless of the background or forecolor settings...is there away 
>to make the cursor the same color as the background...or invisible?
>
>Thanks,
>
>Mark




More information about the AccessD mailing list