Compartilhar via


CreateCursor

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function creates a cursor having the specified size, bit patterns, and hot spot.

Syntax

HCURSOR CreateCursor( 
  HINSTANCE hInst, 
  int xHotSpot, 
  int yHotSpot, 
  int nWidth, 
  int nHeight, 
  CONST VOID* pvANDPlane, 
  CONST VOID* pvXORPlane
); 

Parameters

  • hInst
    [in] Handle to the current instance of the application creating the cursor.
  • xHotSpot
    [in] Specifies the horizontal position of the cursor's hot spot.
  • yHotSpot
    [in] Specifies the vertical position of the cursor's hot spot.
  • nWidth
    [in] Specifies the width, in pixels, of the cursor.
  • nHeight
    [in] Specifies the height, in pixels, of the cursor.
  • pvANDPlane
    [in] Void pointer to an array of bytes that contains the bit values for the AND bitmask of the cursor, as in a device-dependent monochrome bitmap.
  • pvXORPlane
    [in] Void pointer to an array of bytes that contains the bit values for the XOR bitmask of the cursor, as in a device-dependent monochrome bitmap.

Return Value

A handle to the cursor indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

Hotspots should be created with positive location values. If the xHotSpot or yHotSpot parameter has a negative value, the actual hotspot has an arbitrary position.

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.

Requirements

Header winuser.h
Library Iconcurs.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

DestroyCursor
GetSystemMetrics
SetCursor