SetCursor

2.x

  HCURSOR SetCursor(hcur)    
  HCURSOR hcur; /* handle of cursor, */  

The SetCursor function changes the given cursor.

Parameters

hcur

Identifies the cursor resource. The resource must have been loaded by using the LoadCursor function. If this parameter is NULL, the cursor is removed from the screen.

Return Value

The return value is the handle of the previous cursor, if the function is successful. It is NULL if there is no previous cursor.

Comments

The cursor is set only if the new cursor is different from the previous cursor; otherwise, the function returns immediately. The function is quite fast if the new cursor is the same as the old.

The cursor is a shared resource. A window should set the cursor only when the cursor is in the window's client area or when the window is capturing all mouse input. In systems without a mouse, the window should restore the previous cursor before the cursor leaves the client area or before the window relinquishes control to another window.

Any application that must set the cursor while it is in a window must ensure that the class cursor for the given window's class is set to NULL. If the class cursor is not NULL, the system restores the previous shape each time the mouse is moved.

See Also

GetCursor, LoadCursor, ShowCursor