BUG: DCOM95 MTA Clients May Block Broadcast DDE Messages

ID: Q181949

The information in this article applies to:

SYMPTOMS

Due to a bug in the RPC runtime DLLs that ship with DCOM951.1, MTA clients that do not service the message queue may block the global broadcast of DDE messages. When a user double-clicks on a desktop icon, the program associated with the icon may be blocked from launching and Windows Explorer may hang.

CAUSE

A top-level window is created by the RPC runtime on the MTA client thread that called CoCreateInstance(Ex), but the window is not destroyed when the API returns. The client thread has no obligation to service the message queue under the MTA programming model. If it does not, this top-level window causes global DDE broadcast messages to block.

RESOLUTION

To work around this bug, you need to make the client's MTA thread behave like an STA thread (that is, it must service the message queue). If it is blocking on a win32 handle, it must call the MsgWaitForMultipleObjects() API to simultaneously dispatch windows messages. See the REFERENCES section for an article that explains how to do this.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

A thread initializes COM libraries for the Single Threaded Apartment(STA) by calling CoInitializeEx(0, COINIT_APARTMENTTHREADED), or simply CoInitialize() or OleInitialize(). This type of thread must service the message queue for the following two reasons:

A thread initializes COM libraries for the Multi Threaded Apartment(MTA) by calling CoInitializeEx(0, COINIT_MULTITHREADED). This type of thread does not need to service the message queue, because incoming calls into this type of apartment are delivered through RPC runtime threads and not through windows messages. COM does not create any windows when the thread calls CoInitializeEx(0, COINIT_MULTITHREADED). The RPC runtime creates hidden windows as needed to facilitate calls. The RPC runtime does this on its own threads and it services the message queue. However, due to the bug described in this article, the RPC runtime creates a window on the client's thread and does not destroy this window when the call completes. If the client does not service the message queue, this top-level window will block global broadcasts.

REFERENCES

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q136885
   TITLE     : INFO: OLE Threads Must Dispatch Messages

Additional query words:
Keywords          : LeTwoCom 
Issue type        : kbbug

Last Reviewed: April 3, 1998