View Full Version : Loading bitmaps w/ LoadImage and GetObject??

10-06-2002, 10:09 AM
I am trying to load a bitmap from a file.. the following sequence of calls seems to work but the bmp.bits pointer is 0x000000. I assume this is not correct??Anyone ever load bitmaps in this way??

GetObject(pbitmap, sizeof(BITMAP), (LPSTR)&bmp);

10-06-2002, 10:28 AM
Taken from the Win32 API documentation:
If hgdiobj identifies a bitmap created by calling CreateDIBSection, and the specified buffer is large enough, the GetObject function returns a DIBSECTION structure. In addition, the bmBits member of the BITMAP structure contained within the DIBSECTION will contain a pointer to the bitmap?s bit values.

If hgdiobj identifies a bitmap created by any other means, GetObject returns only the width, height, and color format information of the bitmap. You can obtain the bitmap?s bit values by calling the GetDIBits or GetBitmapBits function.

10-06-2002, 12:21 PM
hey thanks the mistake was that I was missing |LR_CREATEDIBSECTION in the loadimage call for anyone interested..