LoadCursorA function

Loads the specified cursor resource from the executable (.EXE) file associated with an application instance.

Note  This function has been superseded by the LoadImage function.
 

Syntax

HCURSOR LoadCursorA(
  HINSTANCE hInstance,
  LPCSTR    lpCursorName
);

Parameters

hInstance

Type: HINSTANCE

A handle to an instance of the module whose executable file contains the cursor to be loaded.

lpCursorName

Type: LPCTSTR

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 also be used to create this value. To use one of the predefined cursors, the application must set the hInstance parameter to NULL and the lpCursorName parameter to one the following values.

Value Meaning
IDC_APPSTARTING
MAKEINTRESOURCE(32650)
Standard arrow and small hourglass
IDC_ARROW
MAKEINTRESOURCE(32512)
Standard arrow
IDC_CROSS
MAKEINTRESOURCE(32515)
Crosshair
IDC_HAND
MAKEINTRESOURCE(32649)
Hand
IDC_HELP
MAKEINTRESOURCE(32651)
Arrow and question mark
IDC_IBEAM
MAKEINTRESOURCE(32513)
I-beam
IDC_ICON
MAKEINTRESOURCE(32641)
Obsolete for applications marked version 4.0 or later.
IDC_NO
MAKEINTRESOURCE(32648)
Slashed circle
IDC_SIZE
MAKEINTRESOURCE(32640)
Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
IDC_SIZEALL
MAKEINTRESOURCE(32646)
Four-pointed arrow pointing north, south, east, and west
IDC_SIZENESW
MAKEINTRESOURCE(32643)
Double-pointed arrow pointing northeast and southwest
IDC_SIZENS
MAKEINTRESOURCE(32645)
Double-pointed arrow pointing north and south
IDC_SIZENWSE
MAKEINTRESOURCE(32642)
Double-pointed arrow pointing northwest and southeast
IDC_SIZEWE
MAKEINTRESOURCE(32644)
Double-pointed arrow pointing west and east
IDC_UPARROW
MAKEINTRESOURCE(32516)
Vertical arrow
IDC_WAIT
MAKEINTRESOURCE(32514)
Hourglass

Return Value

Type: HCURSOR

If the function succeeds, the return value is the handle to the newly loaded cursor.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The LoadCursor function loads the cursor resource only if it has not been loaded; otherwise, it retrieves the handle to the existing resource. This function returns a valid cursor handle only if the lpCursorName parameter is a pointer to a cursor resource. If lpCursorName is a pointer to any type of resource other than a cursor (such as an icon), the return value is not NULL, even though it is not a valid cursor handle.

The LoadCursor function searches the cursor resource most appropriate for the cursor for the current display device. The cursor resource can be a color or monochrome bitmap.

DPI Virtualization

This API does not participate in DPI virtualization. The output returned is not affected by the DPI of the calling thread.

Examples

For an example, see Creating a Cursor.

Requirements

   
Windows version Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

Conceptual

Cursors

LoadImage

MAKEINTRESOURCE

Reference

SetCursor

SetCursorPos

ShowCursor