As I observed, most bitmaps are bottom-up DIB and the biHeight
of BITMAPINFOHEADER are positive. After scanned a bitmap,
I have to save the RGB data in a top-down way because of time issue.
So I set the biHeight negative. If I double-click the bmp file
directly, it can be shown correctly, but can't load it with ::LoadImage();
If I change biHeight to positive, I can load it with ::LoadImage(),
but the bitmap is upside-down.
GetLastError() returns 0x0008. That is Not enough storage is available to process this command.
My bitmap width: 658, height: 256. I think, when I set the height negative, LoadImage() still treats it as unsigned data, and gets the bitmap size by width*height. That's a too huge size.
I rearranged the bmp data in the bottom-up way, kept the height positive, and solved the problem with LoadImage.
But the problem I've mentioned above Does exist. If you still wondered, just modify any bmp to a negative height, load it with LoadImage, and I believe it will return NULL.
Anyway, if you get different result, kindly let me know please.
I'm wondering if any more light has been shed on this issue (I realize it is a very old post)? I started running into it recently pretty consistently on XP and even occasionally on Vista with very small bitmaps.
Bookmarks