Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. One dialog after the other in mfc dialog app

One dialog after the other in mfc dialog app

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi All, I'm sure this has been asked coutnless times before but i'm buggered if i can find the answer anywhere. Got an MFC dialog app. I want to DoModal on the first dialog, and then if the ok button was clicked, create a different dialog and DoModal on that. But the second dialog just returns immediately. Any ideas? Jon

    M M 2 Replies Last reply
    0
    • A Anonymous

      Hi All, I'm sure this has been asked coutnless times before but i'm buggered if i can find the answer anywhere. Got an MFC dialog app. I want to DoModal on the first dialog, and then if the ok button was clicked, create a different dialog and DoModal on that. But the second dialog just returns immediately. Any ideas? Jon

      M Offline
      M Offline
      Mad__
      wrote on last edited by
      #2

      Remove m_pMainWnd assigment from CWinApp::InitInstance and will work

      1 Reply Last reply
      0
      • A Anonymous

        Hi All, I'm sure this has been asked coutnless times before but i'm buggered if i can find the answer anywhere. Got an MFC dialog app. I want to DoModal on the first dialog, and then if the ok button was clicked, create a different dialog and DoModal on that. But the second dialog just returns immediately. Any ideas? Jon

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        make sur the second dialog is a member variable of the first dialog class. and is created with new, not just created on the stack in the function that creates the second dialog. something like

        m_pSecondDialog = new MySecondDialogClass;
        m_pSecondDialog->Create( ... );

        instead of

        MySecondDialogClass dlg;


        Maximilien Lincourt Your Head A Splode - Strong Bad

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups