HCURSOR SetCursor(hCursor)
This function sets the cursor shape to the shape specified by the hCursor parameter. The cursor is set only if the new shape is different from the current shape. Otherwise, the function returns immediately. The SetCursor function is quite fast if the cursor identified by the hCursor parameter is the same as the current cursor.
If hCursor is NULL, the cursor is removed from the screen.
Parameter | Type/Description |
hCursor | HCURSOR Identifies the cursor resource. The resource must have been loaded previously by using the LoadCursor function. |
The return value identifies the cursor resource that defines the previous cursor shape. It is NULL if there is no previous shape.
The cursor is a shared resource. A window that uses the cursor should set the shape only when the cursor is in its client area or when it is capturing all mouse input. In systems without a mouse, the window should restore the previous cursor shape before the cursor leaves the client area or before the window relinquishes control to another window.
Any application that needs to change the shape of the cursor while it is in a window must make sure the class cursor for the given window's class is set to NULL. If the class cursor is not NULL, Windows restores the previous shape each time the mouse is moved.
The cursor is not shown on the screen if the cursor display count is less than zero. This results from the HideCursor function being called more times than the ShowCursor function.