PRB: LoadBitmap GPFaults on Compressed Bitmaps in Windows 3.1Last reviewed: May 31, 1996Article ID: Q151921 |
The information in this article applies to:
SYMPTOMSCalling LoadBitmap from an application causes a General Protection Fault (GPF) when attempting to load a compressed bitmap.
CAUSEThere is a problem with the way the Windows 3.x standard VGA driver handles compressed bitmaps. When a bitmap is saved as compressed, non-VGA drivers tend to leave the biClrUsed member of the BITMAPINFOHEADER at zero. This behavior causes the VGA driver to GPF as it tries to load the bitmap because the VGA driver attempts to decode the color table as though it were RLE encoded data. This can easily lead to running off the end of the data.
RESOLUTIONOne work around would be to use uncompressed bitmaps. However, if compression is absolutely necessary, another way would be to save the bitmap compressed using the VGA driver so the biClrUsed member of the BITMAPINFOHEADER structure is properly set to the number of colors in the color table. Every other driver that then attempts to load the bitmap should be able to do so successfully.
MORE INFORMATIONApplications typically save images in compressed format in order to save space. This behavior can be accomplished in Microsoft Visual C++ version 1.52 by loading the bitmap in App Studio, selecting the Resource.Properties menu item and checking the "Save Compressed" checkbox.
STATUSThis behavior is by design.
|
Additional reference words: 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |