A Program May Stop Responding When the SendMessage Function Is Called (276368)



The information in this article applies to:

  • Microsoft Windows 98
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows Millennium Edition
  • Microsoft Windows 95

This article was previously published under Q276368

SUMMARY

This article discusses what happens when a program calls the SendMessage function.

A program that calls the EnumWindows function and the SendMessage function to each enumerated window handle may stop responding when the SendMessage function is called. This method of broadcasting messages is occasionally used by programs instead of using the BroadcastSystemMessage function, as it gives more control over which windows receive the message.

MORE INFORMATION

The Distributed Component Object Model (DCOM) is implemented in Microsoft Windows 95, Microsoft Windows 98, and Microsoft Windows Millennium Edition (Me) with the remote procedure call (RPC) protocol as a means of transport.

The RPC runtime component can create a hidden top-level window called "OleMainThreadWndClass 0x######## " which is only used for processing RPC-related messages. The hidden RPC window does not process messages outside of the scope of RPC-related messages; therefore, programs calling SendMessage may stop responding while waiting for the RPC window to reply.

Programs must avoid sending messages to this window, as it does not respond. An alternative safer method of calling each window is to use the SendMessageTimeout function, which provides a timeout value as the maximum time to delay waiting for the message to be sent.

Since DCOM uses the RPC transport, programs that use DCOM may seem to cause other problems in unrelated software when the unrelated software calls the SendMessage function to the hidden RPC window. If you press CTRL+ALT+DEL on the keyboard, the computer may display the DCOM program as being unresponsive. This behavior, however, may be caused by the hidden RPC window not replying to a sent message.

Modification Type:MinorLast Reviewed:1/14/2006
Keywords:kbinfo KB276368