CoInitialize() May Cause OLE Applications to Stop Responding

Last reviewed: October 21, 1997
Article ID: Q159273
The information in this article applies to:
  • Microsoft Windows NT operating system version 3.1
  • Microsoft Windows NT Advanced Server version 3.1
  • Microsoft Windows NT Workstation versions 3.5 and 3.51
  • Microsoft Windows NT Server versions 3.5, 3.51, and 4.0

SYMPTOMS

After a Windows OLE application (such as Date/Time in Control Panel) issues a SendMessage(HWND_BRAODCAST) to a console application, the Windows OLE application appears to stop responding.

CAUSE

The console application does not have a Windows message loop.

If a console application calls CoInitialize() to initialize the Component Object Model (COM) library, it does not have a Windows message queue. This causes OLE applications to stop responding while they are waiting for the console application to process their messages. The basic assumption with OLE is that OLE applications are Windows applications, and that they process messages on a regular basis.

WORKAROUND

To work around this problem, do either of the following:

  • Make sure your console application has an active Windows message loop.

    -or-

  • In Windows NT 4.0, instead of using CoIninitialize(), write your code to call CoInitializeEx(NULL, COINIT_MULTITHREADED), which does not use Windows messages for object remote procedure calls (RPCs).


Additional query words: prodnt prodsna 2.11 hang hung crash fail RPC call
Keywords : ntnetserv NTPROTOCOL NTSrvWkst kbinterop kbnetwork
Version : 3.1 3.5 3.51 4.0
Platform : winnt
Issue type : kbprb
Solution Type : kbworkaround


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