Guest_imported
New member
- Jan 1, 1970
- 0
Here's a problem I hope someone else has encountered and resolved at one time or another:
I'm using LoadImage() to load standard 24-bit .bmp files as follows:
HBITMAP hbm = (HBITMAP)LoadImage(NULL, "example.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
I've been using this function since the Win95 days without any problems (I use 2000 now). However, maybe 10-20% of the time, specific bitmap files fail to load properly (they load fine the other 80-90% of the time). The problem is always with the same files which load fine in all paint programs I have.
What's very strange is that a valid handle is returned (hbm isn't NULL and looks like a regular handle value). The content of the bitmap object is, on the other hand, invalid. The bitmap's bmBits is null and dimensions, bit depth, etc. are set to what I assume to be default values (16x16x16, type = 0, etc.). The bitmaps in question are of different sizes.
ANY idea what might be happening here? The only other clue I have is that it ALWAYS fails to load these specific bitmaps on the first try after a fresh boot. After that, it seems random. I doubt very much it's a memory stomp. Furthermore, I've never had this problem when running it from the IDE, both in debug and release.
Thanks for any help.
I'm using LoadImage() to load standard 24-bit .bmp files as follows:
HBITMAP hbm = (HBITMAP)LoadImage(NULL, "example.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
I've been using this function since the Win95 days without any problems (I use 2000 now). However, maybe 10-20% of the time, specific bitmap files fail to load properly (they load fine the other 80-90% of the time). The problem is always with the same files which load fine in all paint programs I have.
What's very strange is that a valid handle is returned (hbm isn't NULL and looks like a regular handle value). The content of the bitmap object is, on the other hand, invalid. The bitmap's bmBits is null and dimensions, bit depth, etc. are set to what I assume to be default values (16x16x16, type = 0, etc.). The bitmaps in question are of different sizes.
ANY idea what might be happening here? The only other clue I have is that it ALWAYS fails to load these specific bitmaps on the first try after a fresh boot. After that, it seems random. I doubt very much it's a memory stomp. Furthermore, I've never had this problem when running it from the IDE, both in debug and release.
Thanks for any help.