PRB: Error in the THSAMPLE Sample Application

Last reviewed: July 23, 1997
Article ID: Q99335
3.10 WINDOWS kbprg kbprb

The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) for Windows version 3.1

SUMMARY

The Microsoft Windows version 3.1 Software Development Kit (SDK) provides a sample called THSAMPLE, which is in the SDK subdirectory \SAMPLES\TOOLHELP. This sample application uses the TOOLHELP.DLL to provide the type of information that HEAPWALK shows.

SYMPTOMS

When the THSAMPLE sample application is run and the Enable List option is enabled from the Notification menu, some of the notification messages are not seen in the notification window.

This problem can be demonstrated, for example, by starting the Windows Help application when the Enable List option is enabled in the THSAMPLE application. (Note that it is preferable to turn off the task switch notifications using the Notification/Task Switch Filter option).

CAUSE

There is a simple error in the THSAMPLE application. THSAMPLE uses NotifyRegister() to register a callback function that receives all the notification messages. This callback function is then posting a user-defined message to itself using PostMessage() for every notification message it receives, and displaying it in the appropriate window.

There is a default limit, however, of eight messages that an application's message queue can hold, whereas the callback could receive a lot more notifications (for example, when some applications are started, a number of LOADSEG notifications are sent).

RESOLUTION

To correct this behavior, the application's message queue size must be increased by using SetMessageQueue() set to an appropriate number. Note that starting and exiting some applications such as Windows Help, Word for Windows, or Excel will produce a large number of LOADSEG and FREESEG notifications. Therefore, it is better to set the message queue size to the maximum of 120 in order to be able to look at most of the notifications.


Additional reference words: 3.10
KBCategory: kbprg kbprb
KBSubcategory: KrToolHlp
Keywords : kb16bitonly


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: July 23, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.