The information in this article applies to:
SYMPTOMSA general protection (GP) fault can occur on a memory-based device context (DC) when a bitmap previously selected in the DC is selected out and another is selected in. This is a common problem when using the SaveDC() and RestoreDC() functions with a memory DC. CAUSE
In a regular (nonmemory-based) DC, when the SaveDC() and RestoreDC()
functions are used, the size of the window client area of the DC does not
change. The size of the drawable area in a memory-based DC is dependent on
the size of the current bitmap selected in the DC.
RESOLUTIONAfter you call RestoreDC() on a memory-based DC, you need to call SelectObject() to select the bitmap that was selected in the DC before RestoreDC() was called. STATUSMicrosoft has confirmed this to be a bug in Windows version 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONThe following code exhibits the problem outlined above. When CreateCompatibleDC() is called, a default 1 x 1 monochrome bitmap is selected into the DC returned from the function. By restoring the initial 1 x 1 bitmap after getting a visible region of 200 x 200, GDI thinks the 1 x 1 surface has a clipping rectangle of 200 x 200. This is what causes the overwrite. Sample Code
Additional query words: buglist3.10 3.10 gpf gp-fault 1x1 200x200
Keywords : |
Last Reviewed: November 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |