PRB: Windows Properties Warning Using GWL_USERDATA in Win32s

Last reviewed: May 17, 1996
Article ID: Q147433
The information in this article applies to:
  • Microsoft Win32s version 1.3

SYMPTOMS

If an application uses SetWindowLong() with GWL_USERDATA in Win32s, then the debug version of Windows will issue warning messages saying that some window properties were not removed when the window is destroyed.

CAUSE

GWL_USERDATA is supported under Win32s, even though this feature is not available under Windows 3.x.

In Win32s, GWL_USERDATA is implemented by adding two window properties to the window, one per 16-bit property. These window properties are not removed by Win32s when the window is destroyed.

RESOLUTION

Even though Win32s does not remove the window properties, they are actually deleted by Windows upon application termination. No memory leak will occur from this problem, so it is safe to ignore the warning in most cases.

In the case where your application uses the GWL_USERDATA with a large number of windows, these window properties are not freed until the application terminates. A workaround or suggestion for such a situation would be to use WNDCLASS.cbWndExtra instead of GWL_USERDATA.

STATUS

This behavior is by design.


Additional reference words: 1.30 win32s gwl_userdata
KBCategory: kbprg kbprb
KBSubcategory: w32s


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.