Microsoft KB Archive/85846

{|
 * width="100%"|

INFO: Using GetDIBits for Retrieving Bitmap Information

 * }

Q85846

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * Microsoft Windows NT Server versions 3.1, 3.5
 * Microsoft Windows NT Workstation versions 3.1, 3.5
 * Microsoft Windows 95

-

SUMMARY
When saving a bitmap in .dib file format, the GDI function is used to retrieve the bitmap information. The general use of this function and the techniques for saving a bitmap in .dib format are largely unchanged; however, this article provides more details on the use of the Win32 API version of the GetDIBits function.

MORE INFORMATION
The function can be used to retrieve the following information:


 * Data in the BitmapInfoHeader (no color table and no bits)
 * Data in the BitmapInfoHeader and the color table (no bits)
 * All the data (BitmapInfoHeader, color table, and the bits)

The fifth and the sixth parameters of the function are used to tell the graphics engine exactly what the application wants it to return. If the fifth parameter is NULL, then no bits will be returned. If the biBitCount is 0 (zero) in the sixth parameter, then no color table will be returned. In addition, the biSize field of the BitmapInfoHeader must be set to either the size of BitmapInfoHeader or BitmapCoreHeader for the function to work properly.

Refer to the Savebmp.c file in the MANDEL sample for details. This sample is included with the Win32 SDK.

Additional query words: 3.10 4.00

Keywords : kbOSWinNT310 kbOSWinNT350 kbSDKWin32 kbOSWin95 kbDSupport

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API