HCURSOR LoadCursor(hinst, lpszCursor) | |||||
HANDLE hinst; | /* handle of application instance | */ | |||
LPCTSTR lpszCursor; | /* 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.
lpszCursor
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 to 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 to 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.
The cursor resource can be either a color or a monochrome bitmap.
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. |
The LoadCursor function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).
SetCursor, ShowCursor