CreateCursor function
Creates a cursor having the specified size, bit patterns, and hot spot.
Syntax
HCURSOR WINAPI CreateCursor( _In_opt_ HINSTANCE hInst, _In_ int xHotSpot, _In_ int yHotSpot, _In_ int nWidth, _In_ int nHeight, _In_ const VOID *pvANDPlane, _In_ const VOID *pvXORPlane );
Parameters
- hInst [in, optional]
-
Type: HINSTANCE
A handle to the current instance of the application creating the cursor.
- xHotSpot [in]
-
Type: int
The horizontal position of the cursor's hot spot.
- yHotSpot [in]
-
Type: int
The vertical position of the cursor's hot spot.
- nWidth [in]
-
Type: int
The width of the cursor, in pixels.
- nHeight [in]
-
Type: int
The height of the cursor, in pixels.
- pvANDPlane [in]
-
Type: const VOID*
An array of bytes that contains the bit values for the AND mask of the cursor, as in a device-dependent monochrome bitmap.
- pvXORPlane [in]
-
Type: const VOID*
An array of bytes that contains the bit values for the XOR mask of the cursor, as in a device-dependent monochrome bitmap.
Return value
Type: HCURSOR
If the function succeeds, the return value is a handle to the cursor.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
The nWidth and nHeight parameters must specify a width and height that are supported by the current display driver, because the system cannot create cursors of other sizes. To determine the width and height supported by the display driver, use the GetSystemMetrics function, specifying the SM_CXCURSOR or SM_CYCURSOR value.
Before closing, an application must call the DestroyCursor function to free any system resources associated with the cursor.
Examples
For an example, see Creating a Cursor.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- CreateIcon
- DestroyCursor
- SetCursor
- Conceptual
- Cursors
- Other Resources
- GetModuleHandle
- GetSystemMetrics