CBitmap::CreateDiscardableBitmap

Syntax

BOOL CreateDiscardableBitmap( CDC* pDC, int nWidth, int nHeight );

Parameters

pDC

Specifies a device context.

nWidth

Specifies the width (in bits) of the bitmap.

nHeight

Specifies the height (in bits) of the bitmap.

Remarks

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

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 CDC::SelectObject or CMetaFileDC::SelectObject function will return NULL.

When an application has finished using the bitmap created by the CreateBitmapIndirect function, it should select the bitmap out of the device context.

Return Value

TRUE if successful; otherwise FALSE.

See Also

::CreateDiscardableBitmap