CreateBitmap

Syntax

HBITMAP CreateBitmap(nWidth,nHeight,nPlanes,nBitCount,lpBits)

This function creates a device-dependent memory bitmap that has the specified width, height, and bit pattern. The bitmap can subsequently be selected as the current bitmap for a memory display by using the SelectObject function.

Although a bitmap cannot be copied directly to a display device, the BitBlt function can copy it from a memory display context (in which it is the current bitmap) to any compatible device.

Parameter Type/Description  

nWidth int Specifies the width (in pixels) of the bitmap.  
nHeight int Specifies the height (in pixels) of the bitmap.  
nPlanes BYTE Specifies the number of color planes in the bitmap. Each plane has nWidth ´ nHeight ´ nBitCount bits.  
nBitCount BYTE Specifies the number of color bits per display pixel.  
lpBits LPSTR Points to a short-integer array that contains the initial bitmap bit values. If it is NULL, the new bitmap is left uninitialized. For more information, see the description of the bmBits field in the BITMAP data structure in Chapter 7, “Data Types and Structures,” in Reference, Volume 2.  

Return Value

The return value identifies a bitmap if the function is successful. Otherwise, it is NULL.