HCURSOR LoadCursor(hinst, pszCursor) | |||||
HINSTANCE hinst; | /* handle of application instance | */ | |||
LPCSTR pszCursor; | /* cursor-name string or cursor resource identifier | */ |
The LoadCursor function loads the specified cursor resource from the executable file associated with the given application instance.
hinst
Identifies an instance of the module whose executable file contains the cursor to be loaded.
pszCursor
Points to a null-terminated string that contains the name of the cursor resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value.
The return value is the handle of the newly loaded cursor if the function is successful. Otherwise, it is NULL.
The function loads the cursor resource only if it has not been loaded; otherwise, it retrieves a handle of the existing resource. The LoadCursor function returns a valid cursor handle only if the pszCursor parameter points to a cursor resource. If pszCursor points to any type of resource other than a cursor (such as an icon), the return value will not be NULL, even though it is not a valid cursor handle.
An application can use the LoadCursor function to access the predefined cursors used by Windows. To do this, the application must set the hinst parameter to NULL and the pszCursor parameter to one the following values:
Value | Meaning |
IDC_ARROW | Standard arrow cursor. |
IDC_CROSS | Crosshair cursor. |
IDC_IBEAM | Text I-beam cursor. |
IDC_ICON | Empty icon. |
IDC_SIZE | A square with a smaller square inside its lower-right corner. |
IDC_SIZENESW | Double-pointed cursor with arrows pointing northeast and southwest. |
IDC_SIZENS | Double-pointed cursor with arrows pointing north and south. |
IDC_SIZENWSE | Double-pointed cursor with arrows pointing northwest and southeast. |
IDC_SIZEWE | Double-pointed cursor with arrows pointing west and east. |
IDC_UPARROW | Vertical arrow cursor. |
IDC_WAIT | Hourglass cursor. |
It is not necessary to destroy these system cursors. An application should use the DestroyCursor function to destroy any private cursors it loads.