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
Related Call: SetCursor
Category: Cursor
Back to the index.