[AccessD] Cursor Color

Heenan, Lambert Lambert.Heenan at AIG.com
Wed Feb 23 09:56:45 CST 2005


Your users will hate you. Changing the caret is a system wide thing I
believe and all applications will show (or not) the caret. If your
application crashes (or you forget to restore the blink rate in some obscure
corner of your code) then the users will be stuck with whatever your code
has set. They will have to reboot to get back to "normal".

Lambert


> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid
> Sent:	Wednesday, February 23, 2005 10:17 AM
> To:	'Access Developers discussion and problem solving'
> Subject:	RE: [AccessD] Cursor Color
> 
> 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
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list