CreateDiscardableBitmap

Syntax

HBITMAP CreateDiscardableBitmap(hDC,nWidth,nHeight)

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

Parameter Type/Description  
hDC HDC Identifies a device context.  
nWidth int Specifies the width (in bits) of the bitmap.  
nHeight int Specifies the height (in bits) of the bitmap.  

Return Value

The return value identifies a 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 display 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. When this occurs, the application should remove the handle to the bitmap by using DeleteObject.