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. DoModal error

DoModal error

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debuggingquestionworkspace
17 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.
  • N Nibu babu thomas

    parichaybp wrote:

    i added the same code m_dCreateDlg->DoModal(); but i am still getting error.

    You haven't included the header file...


    Nibu thomas Software Developer

    P Offline
    P Offline
    parichaybp
    wrote on last edited by
    #5

    I have included the header file in both the files UpdateDlg.h #include "StatusDlg.h" // Added by ClassView #include "CreateDlg.h" // Added by ClassView // UpdateDlg.cpp : implementation file // #include "stdafx.h" #include "DesktopSearch.h" #include "StatusDlg.h" #include "CreateDlg.h" #include "UpdateDlg.h" #include "FoldersDialog.h"

    N 1 Reply Last reply
    0
    • P parichaybp

      I have included the header file in both the files UpdateDlg.h #include "StatusDlg.h" // Added by ClassView #include "CreateDlg.h" // Added by ClassView // UpdateDlg.cpp : implementation file // #include "stdafx.h" #include "DesktopSearch.h" #include "StatusDlg.h" #include "CreateDlg.h" #include "UpdateDlg.h" #include "FoldersDialog.h"

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #6

      parichaybp wrote:

      I have included the header file in both the files

      Why? Including in the header file is enough!


      Nibu thomas Software Developer

      P 1 Reply Last reply
      0
      • N Nibu babu thomas

        parichaybp wrote:

        I have included the header file in both the files

        Why? Including in the header file is enough!


        Nibu thomas Software Developer

        P Offline
        P Offline
        parichaybp
        wrote on last edited by
        #7

        what is the error?? how to fix the error ?? can u plz tell me..

        H 1 Reply Last reply
        0
        • P parichaybp

          what is the error?? how to fix the error ?? can u plz tell me..

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #8

          Whats type CCreateDlg? and (you wrote)CCreateDlg *m_dCreateDlg; then you should use m_dCreateDlg->DoModal(); m_dCreateDlg.DoModal();

          P 1 Reply Last reply
          0
          • P parichaybp

            Hi, i have new button on sigle click i want a dialog window to open i have declared variables as follows.. can anyone help to solve this problem..?? UpdateDlg.h #include "StatusDlg.h" // Added by ClassView #include "CreateDlg.h" // Added by ClassView private: CStatusDlg m_dStatusDlg; class CCreateDlg; //Then declare a pointer: CCreateDlg *m_dCreateDlg; --------------------- // UpdateDlg.cpp : implementation file // #include "stdafx.h" #include "DesktopSearch.h" #include "StatusDlg.h" #include "CreateDlg.h" #include "UpdateDlg.h" #include "FoldersDialog.h" void CUpdateDlg::OnNew() { // TODO: Add your control notification handler code here m_dCreateDlg.DoModal(); } --------------------------------------------------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... UpdateDlg.cpp D:\Parichay\DesktopSearch\DesktopSearch\UpdateDlg.cpp(182) : error C2228: left of '.DoModal' must have class/struct/union type Error executing cl.exe. DesktopSearch.exe - 1 error(s), 0 warning(s)

            _ Offline
            _ Offline
            _AnsHUMAN_
            wrote on last edited by
            #9

            you are declaring the pointer in the CreateDlg file for the dialog That should be done in UpdateDlg.h that's all Vision is Always important and so is your ATTITUDE. Wishes. Anshuman Dandekar

            1 Reply Last reply
            0
            • H Hamid Taebi

              Whats type CCreateDlg? and (you wrote)CCreateDlg *m_dCreateDlg; then you should use m_dCreateDlg->DoModal(); m_dCreateDlg.DoModal();

              P Offline
              P Offline
              parichaybp
              wrote on last edited by
              #10

              Hi white sky, the problem is i have new button in Update dialog window when i click on new button i have to open create dialog window .. so for that i declared CCreateDlg *m_dCreateDlg; member can u plz help me solve this error ----------- UpdateDlg.h #include "StatusDlg.h" // Added by ClassView #include "CreateDlg.h" // Added by ClassView private: CStatusDlg m_dStatusDlg; class CCreateDlg; //Then declare a pointer: CCreateDlg *m_dCreateDlg; --------------------------------------- -------------------- // UpdateDlg.cpp : implementation file // #include "stdafx.h" #include "DesktopSearch.h" #include "StatusDlg.h" #include "CreateDlg.h" #include "UpdateDlg.h" #include "FoldersDialog.h" void CUpdateDlg::OnNew() { // TODO: Add your control notification handler code here m_dCreateDlg->DoModal(); } --------------------------------------------------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... UpdateDlg.cpp D:\Parichay\DesktopSearch\UpdateDlg.cpp(184) : error C2027: use of undefined type 'CCreateDlg' d:\parichay\desktopsearch\updatedlg.h(58) : see declaration of 'CCreateDlg' D:\Parichay\DesktopSearch\UpdateDlg.cpp(184) : error C2227: left of '->DoModal' must point to class/struct/union Error executing cl.exe. DesktopSearch.exe - 2 error(s), 0 warning(s) -- modified at 3:33 Tuesday 11th April, 2006

              H 1 Reply Last reply
              0
              • P parichaybp

                Hi white sky, the problem is i have new button in Update dialog window when i click on new button i have to open create dialog window .. so for that i declared CCreateDlg *m_dCreateDlg; member can u plz help me solve this error ----------- UpdateDlg.h #include "StatusDlg.h" // Added by ClassView #include "CreateDlg.h" // Added by ClassView private: CStatusDlg m_dStatusDlg; class CCreateDlg; //Then declare a pointer: CCreateDlg *m_dCreateDlg; --------------------------------------- -------------------- // UpdateDlg.cpp : implementation file // #include "stdafx.h" #include "DesktopSearch.h" #include "StatusDlg.h" #include "CreateDlg.h" #include "UpdateDlg.h" #include "FoldersDialog.h" void CUpdateDlg::OnNew() { // TODO: Add your control notification handler code here m_dCreateDlg->DoModal(); } --------------------------------------------------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... UpdateDlg.cpp D:\Parichay\DesktopSearch\UpdateDlg.cpp(184) : error C2027: use of undefined type 'CCreateDlg' d:\parichay\desktopsearch\updatedlg.h(58) : see declaration of 'CCreateDlg' D:\Parichay\DesktopSearch\UpdateDlg.cpp(184) : error C2227: left of '->DoModal' must point to class/struct/union Error executing cl.exe. DesktopSearch.exe - 2 error(s), 0 warning(s) -- modified at 3:33 Tuesday 11th April, 2006

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #11

                parichaybp, I think this code dont work because you declare CCreateDlg *m_dCreateDlg; [I think you get a error like this the variable m_dCreateDlg is begin used without.....] and I again repeat question whats type CCreateDlg ? (example in header file -> Is class CCreateDlg : public CDialog?or....)

                P 2 Replies Last reply
                0
                • H Hamid Taebi

                  parichaybp, I think this code dont work because you declare CCreateDlg *m_dCreateDlg; [I think you get a error like this the variable m_dCreateDlg is begin used without.....] and I again repeat question whats type CCreateDlg ? (example in header file -> Is class CCreateDlg : public CDialog?or....)

                  P Offline
                  P Offline
                  parichaybp
                  wrote on last edited by
                  #12

                  CreateDlg is Dialog window its same as UpdateDlg both the dialog window i have added using add resources...

                  H 1 Reply Last reply
                  0
                  • H Hamid Taebi

                    parichaybp, I think this code dont work because you declare CCreateDlg *m_dCreateDlg; [I think you get a error like this the variable m_dCreateDlg is begin used without.....] and I again repeat question whats type CCreateDlg ? (example in header file -> Is class CCreateDlg : public CDialog?or....)

                    P Offline
                    P Offline
                    parichaybp
                    wrote on last edited by
                    #13

                    hi whitesky, Problem is there are 2 Dialog window, in the UpdateDlg dialog when i click on new button it should open create dialog window... please can u tell me what should be done and how the declaration shd be done ...

                    H 1 Reply Last reply
                    0
                    • P parichaybp

                      CreateDlg is Dialog window its same as UpdateDlg both the dialog window i have added using add resources...

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #14

                      parichaybp well, -------------In Main File CssDlg------------------------- #include "test2.h" .... private: class CTest2; //Then declare a pointer: CTest2 *m_dlg; --------------------------- void CssDlg::OnBnClickedButton3() { m_dlg.DoModal(); } d:\Projects\ss\ssDlg.cpp(418): error C2228: left of '.DoModal' must have class/struct/union type then I use void CssDlg::OnBnClickedButton3() { m_dlg->DoModal(); } d:\Projects\ss\ssDlg.cpp(418): error C2027: use of undefined type 'CssDlg::CTest2' d:\Projects\ss\ssDlg.cpp(418): error C2227: left of '->DoModal' must point to class/struct/union I find your problem delete private: class CTest2;//Then declare a pointer: CTest2 *m_dlg; -------------------------------------- and you should CTest2 m_dlg; Now It's work

                      P 1 Reply Last reply
                      0
                      • P parichaybp

                        hi whitesky, Problem is there are 2 Dialog window, in the UpdateDlg dialog when i click on new button it should open create dialog window... please can u tell me what should be done and how the declaration shd be done ...

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #15

                        I think Now it's work

                        1 Reply Last reply
                        0
                        • H Hamid Taebi

                          parichaybp well, -------------In Main File CssDlg------------------------- #include "test2.h" .... private: class CTest2; //Then declare a pointer: CTest2 *m_dlg; --------------------------- void CssDlg::OnBnClickedButton3() { m_dlg.DoModal(); } d:\Projects\ss\ssDlg.cpp(418): error C2228: left of '.DoModal' must have class/struct/union type then I use void CssDlg::OnBnClickedButton3() { m_dlg->DoModal(); } d:\Projects\ss\ssDlg.cpp(418): error C2027: use of undefined type 'CssDlg::CTest2' d:\Projects\ss\ssDlg.cpp(418): error C2227: left of '->DoModal' must point to class/struct/union I find your problem delete private: class CTest2;//Then declare a pointer: CTest2 *m_dlg; -------------------------------------- and you should CTest2 m_dlg; Now It's work

                          P Offline
                          P Offline
                          parichaybp
                          wrote on last edited by
                          #16

                          Hi whitesky, its not working .. can u please have a look private: CStatusDlg m_dStatusDlg; // class CCreateDlg; //Then declare a pointer: CCreateDlg m_dCreateDlg; }; -----Error--- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... CreateDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers DesktopSearch.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers DesktopSearchDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers UpdateDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers D:\Parichay\DesktopSearch\UpdateDlg.cpp(181) : error C2065: 'm_dCreatelg' : undeclared identifier D:\Parichay\DesktopSearch\UpdateDlg.cpp(181) : error C2227: left of '->DoModal' must point to class/struct/union Generating Code... Error executing cl.exe. DesktopSearch.exe - 14 error(s), 0 warning(s)

                          H 1 Reply Last reply
                          0
                          • P parichaybp

                            Hi whitesky, its not working .. can u please have a look private: CStatusDlg m_dStatusDlg; // class CCreateDlg; //Then declare a pointer: CCreateDlg m_dCreateDlg; }; -----Error--- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... CreateDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers DesktopSearch.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers DesktopSearchDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers UpdateDlg.cpp d:\parichay\desktopsearch\updatedlg.h(60) : error C2146: syntax error : missing ';' before identifier 'm_dCreateDlg' d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'CCreateDlg' : missing storage-class or type specifiers d:\parichay\desktopsearch\updatedlg.h(60) : error C2501: 'm_dCreateDlg' : missing storage-class or type specifiers D:\Parichay\DesktopSearch\UpdateDlg.cpp(181) : error C2065: 'm_dCreatelg' : undeclared identifier D:\Parichay\DesktopSearch\UpdateDlg.cpp(181) : error C2227: left of '->DoModal' must point to class/struct/union Generating Code... Error executing cl.exe. DesktopSearch.exe - 14 error(s), 0 warning(s)

                            H Offline
                            H Offline
                            Hamid Taebi
                            wrote on last edited by
                            #17

                            Do you see MSDN for these errors? it is some helpful to you

                            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