AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

How to change the cursorshape?

Create a new .exe project and add a module to it with the following code:

Declare Function CreateCaret Lib _
"user32" (ByVal hwnd As Long, _
ByVal hBitmap As Long, ByVal nWidth _
As Long, ByVal nHeight As Long) As Long

Declare Function ShowCaret Lib _
"user32" (ByVal hwnd As Long) As Long

Declare Function GetFocus Lib _
"user32" () As Long

On form1 place 2 textboxes (with a height for a couple of lines) and 1 picturebox.
Select a bitmap for the picturebox and set the autosize on true.
Code:

Sub Text1_GotFocus()
h& = GetFocus&()
b& = Picture1.Picture
Call CreateCaret(h&, b&, 10, 10)
'handle, bitmap 0=none, width, height
x& = ShowCaret&(h&)
End Sub

Private Sub Text2_GotFocus()
h& = GetFocus&()
Call CreateCaret(h&, 0, 30, 30)
'handle, bitmap 0=none, width, height
x& = ShowCaret&(h&)
End Sub

Execute the app. (F5) and youŽll see the difference of the cursorshapes.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/