PRB: Windows Properties Warning Using GWL_USERDATA in Win32s

ID: Q147433


The information in this article applies to:


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 query words: win32s gwl_userdata


Keywords          : kbWin32s 
Version           : 1.30
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: March 7, 1999