none
MAPISendMail mail window is under application RRS feed

  • Question

  • I have a 64 bit app that uses MAPISendMail. We have a client that has reported an odd issue with the mail window that launches when we call the API that just showed up one day when he was testing on Nov. 7. The user says on Windows8 (and claims on Windows7 too) that on his dual monitor configuration where he docks his laptops (one Win7, one Win8), he can put both Outlook (from Office 2010) and our application next to each other (he leaves some space between them) on his left monitor and run our send mail command where we attach one of our documents (MFC application) and make a call to MAPISendMail. The result can be that the mail window that displays is underneath both Outlook and our application.

    Here is what he does to get that to occur. He first clicks Outlook (in the title bar) to set focus there. Then he clicks our title bar and then our application icon (Fluent UI based app) and when our dropdown shows up, he clicks our send entry and on the popup we show he clicks our send mail command. With that workflow, the mail window shows up under both apps. He claims that is a regression. I have a desktop with dual monitors, 64 bit OS etc. but could not duplicate the issue.

    I looked at our call to MAPISendMail and noticed we did not send in the "ulUIParam" (parent window) so I did so. No difference on my machine so I checked in the fix and the user pulled the product. After that, the window always appears on top of both Outlook and our app. Great.

    Unfortunately, we are an OLE app and in testing the user did not send the mail in a timely manner and got the user gets the "server busy" dialog. I tested that and sure enough I got it too. However I could not escape the dialog (nor could he). When I did retry it comes up quickly so I don't have a chance to send the mail. So I spied on the server busy dialog and saw it belonged to our app. So I used task manager to kill our process (tree). The send mail window remained on the desktop. Did I mention that once I added our app window handle to the call that Outlook is also incapicitated until I send the mail? Well my app is gone, the send mail window is still displayed and Outlook is locked down. Not quite like the send mail window is modal to Outlook as clicking Outlook doesn't cause the send mail window to flash a number of times (clicking my window before the server busy dialog causes the send mail window to flash like a modal dialog does). Since Outlook was locked up, I killed it via task manager (Outlook then tells me I am out of system resources).

    I then went back to my app project and set the OleMessageFilter parameters to prevent the server busy dialog from appearing (large pending delay and retry values) during the MAPISendMail call. I also called BeginBusyState. That pretty much solves most of the issues. But what bothers me is that now Outlook is still unusable until the user actually dismisses the send mail dialog (via send or just closes it out without sending). I suspect this user will eventually notice that and file another regression problem report.

    Our codebase  for our send mail functionality has not changed since 2006. And as I said at first I could not duplicate the issue. But now today (two weeks after I made the fix) I can halfway duplicate the issue. I backed out the change to pass my window handle in and tried the workflow again and I can get the send mail window to come up under our app, but oddly enough, it is over Outlook. I checked my version of mapi32.dll (making sure I examined the one that is loaded into our process) and I see that it is version 6.1.7601.17514 and is from 11/20/2010. That seems to exclude any automatic update change to that DLL (automatic updates could explain a regression appearing).

    By the way, I pass in zero for the session handle and set the flags to:

    MAPI_DIALOG | MAPI_LOGON_UI

    Has anybody seen or heard about this issue? It appears that the send mail window is not a top window wrt our application and/or Outlook. But I have no control over that with the API.

    I would attach the avi the client sent me showing this behavior. But Where is the attach file capability?


    R.D. Holland


    • Edited by RD Holland Saturday, December 1, 2012 4:04 PM
    Saturday, December 1, 2012 4:01 PM

All replies

  • Hi R.D. Holland,

    Thank you for posting in the MSDN Forum.

    I'll involve some experts who are more familiar with your issue. This may take some time.

    Thank you for your patient and understanding.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 4, 2012 4:46 AM
    Moderator
  • We haven’t heard the issue earlier. If you’re using Win 8 and later, try calling MAPISendMailW to send a message. If you’re using Win 7 and earlier, then you can use MAPISendMailHelper to send a message.

    Regards,
    Shailesh G. Rajput
    ______________________________________________
    Microsoft Developer Support - Messaging & Collaboration


    Friday, March 8, 2013 11:37 PM