GetCursor Function

Declare Function GetCursor Lib "user32.dll" () As Long

Platforms: Win 32s, Win 95/98, Win NT

GetCursor finds the handle to the mouse cursor currently in use. This is the cursor that is being used to represent the mouse pointer on the screen. The function returns a handle to the cursor picture if successful, or returns 0 if an error occurs.

Example:

' Display the hourglass for three seconds, then restore
' the mouse cursor to whatever it was originally.
Dim holdcursor As Long  ' receives handle to the original cursor
Dim hcursor As Long  ' receives handle to the hourglass (wait) cursor
Dim retval As Long  ' throw-away return value

holdcursor = GetCursor()  ' get the handle of the current mouse cursor
hcursor = LoadCursor(0, IDC_WAIT)  ' load the hourglass cursor
retval = SetCursor(hcursor)  ' set the cursor to the hourglass
Sleep 3000  ' wait for three seconds
retval = SetCursor(holdcursor)  ' restore the original cursor

See Also: SetCursor
Category: Cursor

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/(?/name).html