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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Multiple dialogs in an application

Multiple dialogs in an application

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
5 Posts 4 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.
  • L Offline
    L Offline
    Lord Kixdemp
    wrote on last edited by
    #1

    Hello everyone! It's been a while since I had to bother you guys with such a noob question, but I couldn't find an answer anywhere. :( I want to have two MFC dialog windows open at the same time, both usable by the user. I don't mind using threads. Any hints? Thanks in advance.

    Windows Calculator told me I will die at 28. :(

    M Z N 3 Replies Last reply
    0
    • L Lord Kixdemp

      Hello everyone! It's been a while since I had to bother you guys with such a noob question, but I couldn't find an answer anywhere. :( I want to have two MFC dialog windows open at the same time, both usable by the user. I don't mind using threads. Any hints? Thanks in advance.

      Windows Calculator told me I will die at 28. :(

      M Offline
      M Offline
      Mukesh Kumar
      wrote on last edited by
      #2

      You should use Modeless dialog boxes

      Mukesh Kumar Software Engineer

      1 Reply Last reply
      0
      • L Lord Kixdemp

        Hello everyone! It's been a while since I had to bother you guys with such a noob question, but I couldn't find an answer anywhere. :( I want to have two MFC dialog windows open at the same time, both usable by the user. I don't mind using threads. Any hints? Thanks in advance.

        Windows Calculator told me I will die at 28. :(

        Z Offline
        Z Offline
        zafersavas
        wrote on last edited by
        #3

        Hi, It's called "Modeless Dialog". Search the forum for "how to create Modeless Dialogs". Anyway here are the steps : 1) Add a "form" by right clicking on the class view 2) Include the header file name of the new form class to the source code where you would like to call the modeless dialog 3) To create and show the modeless dialog you should write a code piece like this:

        void CTempDlg::OnButton1()
        {
        Modeless* modlessDlg = new Modeless(this);
        modlessDlg->Create(IDD_MODELESS_DIALOG, NULL);
        modlessDlg->ShowWindow(SW_SHOW);
        }

        L 1 Reply Last reply
        0
        • Z zafersavas

          Hi, It's called "Modeless Dialog". Search the forum for "how to create Modeless Dialogs". Anyway here are the steps : 1) Add a "form" by right clicking on the class view 2) Include the header file name of the new form class to the source code where you would like to call the modeless dialog 3) To create and show the modeless dialog you should write a code piece like this:

          void CTempDlg::OnButton1()
          {
          Modeless* modlessDlg = new Modeless(this);
          modlessDlg->Create(IDD_MODELESS_DIALOG, NULL);
          modlessDlg->ShowWindow(SW_SHOW);
          }

          L Offline
          L Offline
          Lord Kixdemp
          wrote on last edited by
          #4

          Hah. I was doing this instead:

          void CTempDlg::OnButton1()
          {
          Modeless modlessDlg;
          modlessDlg->Create(IDD_MODELESS_DIALOG, NULL);
          modlessDlg->ShowWindow(SW_SHOW);
          }

          The window closed before it could open, I'm guessing because the object got automatically deleted after that function call. Stupid me. Thanks very much! :)

          Windows Calculator told me I will die at 28. :(

          1 Reply Last reply
          0
          • L Lord Kixdemp

            Hello everyone! It's been a while since I had to bother you guys with such a noob question, but I couldn't find an answer anywhere. :( I want to have two MFC dialog windows open at the same time, both usable by the user. I don't mind using threads. Any hints? Thanks in advance.

            Windows Calculator told me I will die at 28. :(

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            If your needs are not so big with the dialogs is ok, but if you need more functionality you can also add classes/forms from CFormView and ataching it to the document, so you have more than one view with the same document. It is more difficult to implement, but that way you have more support to messages that are difficult or can't be called from dialogs. Are you interested in this?

            Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

            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