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. Modal dialog problem

Modal dialog problem

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
8 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.
  • J Offline
    J Offline
    Johnny Peszek
    wrote on last edited by
    #1

    Hi! I have dialog based application with one modal dialog. The modal dialog should take some data from dialog based application and display it on the screen in the Edit Box. How to do it? Thanks!

    D 1 Reply Last reply
    0
    • J Johnny Peszek

      Hi! I have dialog based application with one modal dialog. The modal dialog should take some data from dialog based application and display it on the screen in the Edit Box. How to do it? Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      It sounds like there are two programs involved here. Is that correct? If so, you'll need to use some form of IPC such as DDE, clipboard, RPC, or the WM_COPYDATA message. Johnny Peszek wrote: ...and display it on the screen in the Edit Box. Use CWnd::SetWindowText(), or send the edit control a WM_SETTEXT message.


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      M J 2 Replies Last reply
      0
      • D David Crow

        It sounds like there are two programs involved here. Is that correct? If so, you'll need to use some form of IPC such as DDE, clipboard, RPC, or the WM_COPYDATA message. Johnny Peszek wrote: ...and display it on the screen in the Edit Box. Use CWnd::SetWindowText(), or send the edit control a WM_SETTEXT message.


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

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

        no, I think he want to have the parent's dialog application data display in a modal dialog of that dialog application anyway, You can either passer the data in the modal dialog constructor ( override the current constructor ) or pass the parent pointer to the modal dialog.


        Maximilien Lincourt Your Head A Splode - Strong Bad

        1 Reply Last reply
        0
        • D David Crow

          It sounds like there are two programs involved here. Is that correct? If so, you'll need to use some form of IPC such as DDE, clipboard, RPC, or the WM_COPYDATA message. Johnny Peszek wrote: ...and display it on the screen in the Edit Box. Use CWnd::SetWindowText(), or send the edit control a WM_SETTEXT message.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          J Offline
          J Offline
          Johnny Peszek
          wrote on last edited by
          #4

          As a matter of fact there is only one program (dialog based) and it processes data. And there is also a modal dialog as an inserted dialog resource. Regards.

          D 1 Reply Last reply
          0
          • J Johnny Peszek

            As a matter of fact there is only one program (dialog based) and it processes data. And there is also a modal dialog as an inserted dialog resource. Regards.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            That's simple enough then. Change the constructor of the second dialog to also accept a pointer to the first dialog (the parent). Then the second dialog will have access to properties/methods of the first dialog. Something like:

            class CDialog2 : public CDialog
            {
            public:
            CDialog2( CDialog1 *pDlg, CWnd *pParent = NULL);
            private:
            CDialog1 *m_pDlg;
            }

            CDialog2::CDialog2( CDialog1 *pDlg, CWnd *pParent )
            : CDialog(CDialog2::IDD, pParent)
            {
            m_pDlg = pDlg;
            }
            ...
            // in a CDialog1 method
            CDialog2 dlg(this);
            dlg.DoModal();


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            J 1 Reply Last reply
            0
            • D David Crow

              That's simple enough then. Change the constructor of the second dialog to also accept a pointer to the first dialog (the parent). Then the second dialog will have access to properties/methods of the first dialog. Something like:

              class CDialog2 : public CDialog
              {
              public:
              CDialog2( CDialog1 *pDlg, CWnd *pParent = NULL);
              private:
              CDialog1 *m_pDlg;
              }

              CDialog2::CDialog2( CDialog1 *pDlg, CWnd *pParent )
              : CDialog(CDialog2::IDD, pParent)
              {
              m_pDlg = pDlg;
              }
              ...
              // in a CDialog1 method
              CDialog2 dlg(this);
              dlg.DoModal();


              "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

              J Offline
              J Offline
              Johnny Peszek
              wrote on last edited by
              #6

              It looks fine. I have done everything as you wrote but there is 1 error: “error C2512: 'CDialog2' : no appropriate default constructor available”. The error occurs in the method of the CDialog1 in line with CDialog2 dlg; What should I do? Regards.

              D 1 Reply Last reply
              0
              • J Johnny Peszek

                It looks fine. I have done everything as you wrote but there is 1 error: “error C2512: 'CDialog2' : no appropriate default constructor available”. The error occurs in the method of the CDialog1 in line with CDialog2 dlg; What should I do? Regards.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                I messed up. :doh: Johnny Peszek wrote: What should I do? Recheck my post again. Sorry about that.


                "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                J 1 Reply Last reply
                0
                • D David Crow

                  I messed up. :doh: Johnny Peszek wrote: What should I do? Recheck my post again. Sorry about that.


                  "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                  J Offline
                  J Offline
                  Johnny Peszek
                  wrote on last edited by
                  #8

                  Ok I will do that. Thanks.

                  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