The bit map can be specified by a bit-map handle, or (if this is NULL) a DC handle, in which case the device context must be a memory DC with a bit map currently selected.
When the bit-map handle is NULL, the DC must be a memory DC with a bit map currently selected. Otherwise, the DC handle must be valid for that device. The BITMAPINFO or BITMAPINFO2 structure must be initialized with the values of cPlanes and cBitcount for the format of data required. This must be one of the standard formats or a device-specific format that matches the DC. On return, cx, cy, and argbColors are supplied by the system. Conversion of the bit-map data is carried out, if necessary.
pBitmap must point to a storage area large enough to contain data for the requested number of scan lines. The amount of storage required for one scan line can be determined by calling GetBitmapParameters:
((cBitcount * cx + 31)/32) * cPlanes * 4 bytes