please dont rip this site Prev Next

CreateDIBitmap info  Overview  Group

The CreateDIBitmap function creates a device-dependent bitmap (DDB) from a device-independent bitmap (DIB) and, optionally, sets the bitmap bits.

HBITMAP CreateDIBitmap(

    HDC hdc,

// handle to device context


// pointer to bitmap size and format data

    DWORD fdwInit,

// initialization flag

    CONST VOID *lpbInit,

// pointer to initialization data


// pointer to bitmap color-format data

    UINT fuUsage 

// color-data usage



Identifies a device context.
Points to a BITMAPINFOHEADER structure.

If fdwInit is CBM_INIT, the function uses the BITMAPINFOHEADER structure to obtain the desired width and height of the bitmap as well as other information. Note that a positive value for the height indicates a bottom-up DIB while a negative value for the height indicates a top-down DIB. This scenario is compatible with the CreateDIBitmap function.

A set of bit flags that specify how the operating system initializes the bitmapís bits.

The following bit flag constant is defined:




If this flag is set, the operating system uses the data pointed to by the lpbInit and lpbmi parameters to initialize the bitmapís bits.

If this flag is clear, the data pointed to by those parameters is not used.

If fdwInit is zero, the operating system does not initialize the bitmapís bits.

Points to an array of bytes containing the initial bitmap data. The format of the data depends on the biBitCount member of the BITMAPINFO structure to which the lpbmi parameter points.
Points to a BITMAPINFO structure that describes the dimensions and color format of the array pointed to by the lpbInit parameter.
Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or palette indices. The fuUsage parameter must be one of the following values:




A color table is provided and consists of an array of 16-bit indices into the logical palette of the device context into which the bitmap is to be selected.


A color table is provided and contains literal RGB values.

Return Values

If the function succeeds, the return value is a handle to the bitmap.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.


The CBM_CREATDIB flag for the fdwInit parameter is no longer supported.

When you no longer need the bitmap, call the DeleteObject function to delete it.

See Also

BITMAPINFOHEADER, BITMAPINFO, DeleteObject, GetDeviceCaps, GetSystemPaletteEntries, SelectObject


file: /Techref/os/win/api/win32/func/src/f08_17.htm, 6KB, , updated: 2001/11/14 10:31, local time: 2024/6/22 14:35,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> CreateDIBitmap</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!