The information in this article applies to:
SYMPTOMSWhen the COLORS1 sample application on pages 227-232 of the book "Programming Windows 3" by Charles Petzold (Microsoft Press) is run under Windows 3.1, the amount of free system resources available after the program is complete is less than the amount available before running the program. CAUSEThe program allocates system resources and does not free them. RESOLUTION
Make the following modifications to the WndProc function in the
COLORS1 sample:
MORE INFORMATION
In both cases above, the call to DeleteObject fails because the brush
is selected into a device context (DC). Each time the user moves one
of the scroll bars, the program creates a new brush from the GDI
module's heap space. Once the GDI heap reaches its limit of 64
kilobytes, none of the applications running in the system can create
GDI objects.
The resolution to this situation is to select a different brush into the DC, and then to delete the old brush. Because the SetClassWord function returns the previous value for the specified class word, it is very straightforward to pass the return value from SetClassWord to DeleteObject. Additional query words: 3.10
Keywords : kb16bitonly |
Last Reviewed: November 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |