CreateDiscardableBitmap

2.x

  HBITMAP CreateDiscardableBitmap(hdc, nWidth, nHeight)    
  HDC hdc; /* handle of device context */
  int nWidth; /* bitmap width, */  
  int nHeight; /* bitmap height, */  

The CreateDiscardableBitmap function creates a discardable bitmap that is compatible with the given device. The bitmap has the same number of color planes or the same bits-per-pixel format as the device. An application can select this bitmap as the current bitmap for a memory device that is compatible with the one identified by the hdc parameter.

Parameters

hdc

Identifies the device context.

nWidth

Specifies the width, in bits, of the bitmap.

nHeight

Specifies the height, in bits, of the bitmap.

Return Value

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

Comments

Windows can discard a bitmap created by this function only if an application has not selected it into a device context. If Windows discards the bitmap when it is not selected and the application later attempts to select it, the SelectObject function will return zero.

Applications should use the DeleteObject function to delete the handle returned by the CreateDiscardableBitmap function, even if Windows has discarded the bitmap.

See Also

CreateBitmap, CreateBitmapIndirect, CreateDIBitmap, DeleteObject