MessageBox On Exit

I am developing a dialog based application for PocketPC 2003 in Visual C++, and I would like it to pop up a warning box after the user dismisses the main dialog box if certain conditions are met. I tried putting the MessageBox command into the the code block that runs after the user presses "OK", but while this produces the message box properly, it also closes it immediately thereafter. I also tried making a new dialog class/resource, and doing a DoModal() function in the same code block, with no luck. Is there some way I can get a message box to show on exit (any time after the user presses OK on the main dialog) and remain on the screen until the user dismisses it I found a similar request in another thread, but it was based on C#. I may be able to take the concepts present there and make them work in my application, but I figured it wouldn't hurt to ask :)

Israel Brewster
Computer Support Tech.
Frontier Flying Service, Inc.
5245 Airport Industrial Wy.
Fairbanks, AK 99709
907-450-7250x293


Answer this question

MessageBox On Exit

  • choupette

    Moving to appropriate forum.



  • MJC2006

    Ok, got it. Just needed to add the MB_SETFOREGROUND flag to the MessageBox call.

  • nmahesh567

    Ok, so I managed to get this functioning by adding an OnDestroy message handler to my code, with one problem: the message box comes up beind any other applications that may be running. If, for example, the File Explorer is open when I exit my program, I won't see the dialog box. How can I make it open in the forground rather than the background Thanks.

    Israel Brewster
    Computer Support Tech.
    Frontier Flying Service, Inc.
    5245 Airport Industrial Wy.
    Fairbanks, AK 99709
    907-450-7250x293


  • MessageBox On Exit