Microsoft KB Archive/171428: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 81: Line 81:


Code sample that demonstrates issue follows:
Code sample that demonstrates issue follows:
<pre class="codesample">    #include &quot;mapix.h&quot;
<pre class="codesample">    #include "mapix.h"
     #include &quot;conio.h&quot;
     #include "conio.h"


     void main()
     void main()

Latest revision as of 10:06, 21 July 2020

Knowledge Base


Article ID: 171428

Article Last Modified on 8/18/2005



APPLIES TO

  • Microsoft Messaging Application Programming Interface



This article was previously published under Q171428

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:

74042 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();
    }
  1. Build the code sample above as a console application.
  2. Run the application.
  3. Switch to the Control Panel and launch Date/Time
  4. 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: kbmsg kbprb kbcode KB171428