Declare Function SetCursor Lib "user32.dll" (ByVal hCursor As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
SetCursor sets the image used to represent the mouse cursor. The new cursor can be any valid cursor that has either been created or loaded. If successful, the function returns a handle to the old cursor image. If unsuccessful, the function returns 0.
Example:
' Display the application starting (arrow and hourglass) Windows
' cursor for three seconds. The cursor resource is loaded from Windows. Then
' restore the old cursor (whatever it happens to be).
Dim hcursor As Long ' receives handle to application starting cursor
Dim holdcursor As Long ' receives handle to previously used cursor
Dim retval As Long ' throw-away return value
hcursor = LoadCursor(0, IDC_APPSTARTING) ' load Windows's application starting cursor
holdcursor = SetCursor(hcursor) ' set it to the new cursor
Sleep 3000 ' wait for 3 seconds
retval = SetCursor(holdcursor) ' set it to the previous cursor
Related Calls: GetCursor, SetSystemCursor
Category: Cursor
Back to the index.