PRB: MAPIInitialize from Console App can Block Windows Messages

Last reviewed: July 18, 1997
Article ID: Q171428
The information in this article applies to:
  • Extended Messaging Application Programming Interface (MAPI), version 1.0

SYMPTOMS

Calling the MAPIInitialize() function from a console application can block windows messages to other Windows applications.

CAUSE

The console application has not provided a message loop to allow the Windows Operating System to address the requests of other Windows applications.

RESOLUTION

Write the code as a Windows application or alternately try using the PeekMessage loop API call.

For more information on implementing PeekMessage loop functionality, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q74042
   TITLE     : How to Use PeekMessage() Correctly in Windows

STATUS

This behavior is by design.

MORE INFORMATION

Code sample that demonstrates issue follows:

    #include "mapix.h"
    #include "conio.h"

    void main()
    {
       HRESULT hrT = NOERROR;
       hrT = MAPIInitialize(NULL);
       getch();
    }

  • Build the code sample above as a console application.

  • Run the application.

  • Switch to the Control Panel and launch Date/Time

  • Change the date and click OK.

    Step 4 should close Date/Time, but it remains open and blocked until the (MAPIInitialize) application is closed.


  • Keywords : EMAPI kbcode
    Version : WINDOWS:1.0
    Platform : WINDOWS
    Issue type : kbprb


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