SetSystemCursor Function

Declare Function SetSystemCursor Lib "user32.dll" (ByVal hcur As Long, ByVal id As Long) As Long

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

SetSystemCursor changes one of the cursors that Windows provides. For example, this function can change the cursor used to represent the default arrow cursor. Be careful using this function, since this redefines the default cursors instead of simply setting the current look of the cursor. The function destroys the cursor handle passed to it once it sets the new default cursor. The function returns 1 if successful, or 0 if an error occured.

hcur
A handle to the cursor to use as the new default cursor for a given type of cursor. The function destroys this handle once the new cursor is set.
id
Exactly one of the following flags specifying which of the Windows default cursors to redefine:
OCR_APPSTARTING = 32650
The application starting (arrow and hourglass) cursor.
OCR_CROSS = 32515
The cross-shaped cursor.
OCR_IBEAM = 32513
The text selection (I-beam) cursor.
OCR_ICON = 32641
Win NT only: The empty icon cursor.
OCR_NO = 32648
The "no"-symbol (circle with slash through it) cursor.
OCR_NORMAL = 32512
The normal arrow cursor.
OCR_SIZE = 32640
Win NT only: The four-arrow resize/move cursor.
OCR_SIZEALL = 32646
The four-arrow resize/move cursor.
OCR_SIZENESW = 32643
The double-arrow resize/move cursor pointing to the upper-right and lower-left.
OCR_SIZENS = 32645
The double-arrow resize/move cursor pointing up and down.
OCR_SIZENWSE = 32642
The double-arrow resize/move cursor pointing to the upper-left and lower-right.
OCR_SIZEWE = 32644
The double-arrow resize/move cursor pointing left and right.
OCR_UP = 32516
The up arrow cursor.
OCR_WAIT = 32514
The waiting (hourglass) cursor.

Example:

' Set Windows's default "hourglass" cursor to the cursor in
' C:\MyProg\NewWait.ani.
Dim hcursor As Long  ' receives handle to the cursor from the file
Dim retval As Long  ' return value

' Load the desired cursor from the file:
hcursor = LoadCursorFromFile("C:\MyProg\NewWait.ani")
retval = SetSystemCursor(hcursor, OCR_WAIT)  ' redefine hourglass cursor
' Now Windows will use NewWait.ani as the hourglass 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/s/setsystemcursor.html