The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format. int GetDIBits(
  HDC hdc,           // handle to DC
  HBITMAP hbmp,      // handle to bitmap
  UINT uStartScan,   // first scan line to set
  UINT cScanLines,   // number of scan lines to copy
  LPVOID lpvBits,    // array for bitmap bits
  LPBITMAPINFO lpbi, // bitmap data buffer
  UINT uUsage        // RGB or palette index
);
Parameters
hdc 
[in] Handle to the device context. 
hbmp 
[in] Handle to the bitmap. This must be a compatible bitmap (DDB). 
uStartScan 
[in] Specifies the first scan line to retrieve. 
cScanLines 
[in] Specifies the number of scan lines to retrieve. 
lpvBits 
[out] Pointer to a buffer to receive the bitmap data. If this parameter is NULL, the function passes the dimensions and format of the bitmap to the BITMAPINFO structure pointed to by the lpbi parameter. 
lpbi 
[in/out] Pointer to a BITMAPINFO structure that specifies the desired format for the DIB data. 
uUsage 
[in] Specifies the format of the bmiColors member of the BITMAPINFO structure. It must be one of the following values.