Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Associates a new cursor image with the static control.

HCURSOR SetCursor(
   HCURSOR hCursor 



Handle of the cursor to be drawn in the static control.

The handle of the cursor previously associated with the static control, or NULL if no cursor was associated with the static control.

The cursor will be automatically drawn in the static control. By default, it will be drawn in the upper-left corner and the static control will be resized to the size of the cursor.

You can use various window and static control styles, including the following:

  • SS_ICON   Use this style always for cursors and icons.

  • SS_CENTERIMAGE   Use to center in the static control. If the image is larger than the static control, it will be clipped. If it is smaller than the static control, the empty space around the image will be filled with the background color of the static control.

CStatic myStatic;

// Create a child icon static control.
myStatic.Create(_T("my static"), 

// Set the image of the static control to be the system arrow 
// and small hourglass cursor.
myStatic.SetCursor( ::LoadCursor(NULL, IDC_APPSTARTING) );
© 2016 Microsoft