Displaying a dialog box in Dialog-based MFC app

Displaying a dialog box in Dialog-based MFC app

Post by Alex Kasma » Fri, 18 Jul 1997 04:00:00



// In a dialog-based MFC application, it appears that one cannot pop
// up a message box after displaying one or more dialog boxes
// (see also MFC KBase article #Q138681):

BOOL CMyWinApp::InitInstance()
{
        m_pMainWnd = NULL;      // needed to prevent WM_QUIT

        CMyDialog1 dlg1;
        dlg1.DoModal();         // succeeds

        CMyDialog2 dlg2;
        dlg2.DoModal();         // succeeds

        if ( ::MessageBox(NULL, "View results ?", "App",
                                        MB_ICONINFORMATION | MB_YESNO) == IDYES )
        {
                // the message box fails to display;
                // it flashes briefly and disappears
                // without accepting user input
                // the following code always executes:
                int x;
                x = 0;  // whatever
        }

Quote:}

// How can I force the message box to display?

Thank you,
Alex

 
 
 

1. Dialog App / Dialog App / Dialog App

Back on Wed. someone posted about having a VC++ project file for creating an
dialog box app.  I tried sending you mail, but it bounced back.  I lost that
message. :(

Could you repost your mail adrress, or send me a pointer to the source?  Mucho
appreciated!

--- Gavin (Visualize Whirled Peas!)

Gavin Adams                              GEnie: G.ADAMS13
Digital Equipment Corporation            #3644, 666th FS Internet Daemons

505.662.2011

2. Thank You for the 'II Alive Apple II Review' VCR

3. MFC:Drawing in a dialog box based app

4. Frontier and A4000/040

5. Displaying a second DIALOG BOX from another DIALOG BOX????

6. CDR Firmware

7. How to make a start dialog box maximized under dialog based program?

8. Trapping Keystrokes in a Dialog Box or Dialog based application

9. How do I define ICON for MFC dialog based app with no title bar?

10. Dialog Based CE App (non MFC)