CreateIcon

  HICON CreateIcon(hinst, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)    
  HANDLE hinst; /* handle of application instance */
  int nWidth; /* icon width */
  int nHeight; /* icon height */
  BYTE cPlanes; /* number of planes in XOR mask */
  BYTE cBitsPixel; /* number of bits per pixel in XOR mask */
  CONST BYTE *lpbANDbits; /* address of AND mask array */
  CONST BYTE *lpbXORbits; /* address of XOR mask array */

The CreateIcon function creates an icon that has the specified width, height, colors, and bit patterns.

Parameters

hinst

Identifies an instance of the module that will create the icon.

nWidth

Specifies the width, in pixels, of the icon.

nHeight

Specifies the height, in pixels, of the icon.

cPlanes

Specifies the number of planes in the XOR mask of the icon.

cBitsPixel

Specifies the number of bits per pixel in the XOR mask of the icon.

lpbANDbits

Points to an array of bytes that contains the bit values for the AND mask of the icon. This array must specify a monochrome mask.

lpbXORbits

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

Return Value

The return value identifies an icon 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 icons of other sizes. An application can determine the width and height supported by the display driver by calling the GetSystemMetrics function, specifying the SM_CXICON or SM_CYICON value.

Before terminating, an application must call the DestroyIcon function to free system resources associated with the icon.

See Also

DestroyIcon, GetSystemMetrics