Share via


CreateCursor (Compact 2013)

3/28/2014

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 yHotSpotparameter 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.

This function can create only monochrome cursors.

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

See Also

Reference

Mouse Functions
DestroyCursor
GetSystemMetrics
SetCursor