How to control Outlook modal window RRS feed

  • Question

  • Hi,

    I have an application with which i try to work with Outlook using MAPI. I open form for some contact using the approach from mfcmapi to create modeless form  - CMyMAPIFormViewer class. Tthen, I open address list from that form in modal window clicking e-mail button. The question is - how can i control this modal window? Particularly how can i close it. The reason behind it - at some moment i want to terminate thread which initialized MAPI, and if i do this before closing this modal window i get crash while dispatching messages. I can close the form i created but that won't close modal window.

    Thank you.

    Monday, September 17, 2012 12:54 PM


  • Firstly, the MAPI form API is buggy. Is using the Outlook Object Model is an option? You could then use MailItem.Displat.

    You can retrieve the HWND of an Outlook inpsector by QI'ing it for IOleWindow and calling IOleWindow::GetWindow.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, September 17, 2012 10:19 PM