CreateCursor

3.0

  HCURSOR CreateCursor(hinst, xHotSpot, yHotSpot, nWidth, nHeight, lpvANDplane, lpvXORplane)    
  HINSTANCE hinst; /* handle of application instance */
  int xHotSpot; /* horizontal position of hot spot */
  int yHotSpot; /* vertical position of hot spot */
  int nWidth; /* cursor width, */  
  int nHeight; /* cursor height, */  
  const void FAR* lpvANDplane; /* address of AND mask array */
  const void FAR* lpvXORplane; /* address of XOR mask array */

The CreateCursor function creates a cursor that has the specified width, height, and bit patterns.

Parameters

hinst

Identifies the instance of the module that will create the cursor.

xHotSpot

Specifies the horizontal position of the cursor hot spot.

yHotSpot

Specifies the vertical position of the cursor hot spot.

nWidth

Specifies the width, in pixels, of the cursor.

nHeight

Specifies the height, in pixels, of the cursor.

lpvANDplane

Points to an array of bytes that contains the bit values for the AND mask of the cursor. These can be the bits of a device-dependent monochrome bitmap.

lpvXORplane

Points to an array of bytes that contains the bit values for the XOR mask of the cursor. These can be the bits of a device-dependent monochrome bitmap.

Return Value

The return value is the handle of the cursor if the function is successful. Otherwise, it is NULL.

Comments

The nWidth and nHeight parameters must specify a width and height supported by the current display driver, since the system cannot create cursors of other sizes. An application can determine the width and height supported by the display driver by calling the GetSystemMetrics function and specifying the SM_CXCURSOR or SM_CYCURSOR value.

Before terminating, an application must call the DestroyCursor function to free any system resources associated with the cursor.

See Also

CreateIcon, DestroyCursor, GetSystemMetrics, SetCursor