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. Question under MFC...

Question under MFC...

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiontutorial
6 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.
  • N Offline
    N Offline
    NewbieStats
    wrote on last edited by
    #1

    Hey... Ive been making a Program with Microsoft Visual C++ 6.0... Ive made it so that my Main interface window has buttons, and ive made other CDialog resources but I dont know how to make it so when i click on the Button on the main interface itll open another CDialog window... How would i do that? void CClientDlg::OnButton01() { /*How do i Link it to Button01.cpp or IDD_Dialog1?*/ } Just a Human Trying to Live in a Computers World.

    T 1 Reply Last reply
    0
    • N NewbieStats

      Hey... Ive been making a Program with Microsoft Visual C++ 6.0... Ive made it so that my Main interface window has buttons, and ive made other CDialog resources but I dont know how to make it so when i click on the Button on the main interface itll open another CDialog window... How would i do that? void CClientDlg::OnButton01() { /*How do i Link it to Button01.cpp or IDD_Dialog1?*/ } Just a Human Trying to Live in a Computers World.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      easy...

      void CClientDlg::OnButton01() {
      CMyDialog dlg;
      dlg.DoModal();
      }

      I suppose CMyDialog is a CDialog derived object that is associated with your IDD_Dialog1 dialog ... you've got it ;)


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      N 1 Reply Last reply
      0
      • T toxcct

        easy...

        void CClientDlg::OnButton01() {
        CMyDialog dlg;
        dlg.DoModal();
        }

        I suppose CMyDialog is a CDialog derived object that is associated with your IDD_Dialog1 dialog ... you've got it ;)


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        N Offline
        N Offline
        NewbieStats
        wrote on last edited by
        #3

        That Helps So Much! I have one Question tho... Its driving me Crazy... void CClientDlg::OnButton01() { CClientDlg dlg; dlg.DoModal(); } Works Perfectly, If i click on Button01, The main interface opens again (Note: So button activates Window)... But i created a new Dialog, (Class: CButton01Dlg) (CPP: Button01Dlg.cpp) and when i use the following code it gives me 4 errors, 0 warnings... void CClientDlg::OnButton01() { CButton01Dlg dlg; dlg.DoModal(); } C:\*\ClientDlg.cpp(179) : error C2065: 'CButton01Dlg' : undeclared identifier C:\*\ClientDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier 'dlg' C:\*\ClientDlg.cpp(179) : error C2065: 'dlg' : undeclared identifier C:\*\ClientDlg.cpp(180) : error C2228: left of '.DoModal' must have class/struct/union type Just a Human Trying to Live in a Computers World.

        C T 2 Replies Last reply
        0
        • N NewbieStats

          That Helps So Much! I have one Question tho... Its driving me Crazy... void CClientDlg::OnButton01() { CClientDlg dlg; dlg.DoModal(); } Works Perfectly, If i click on Button01, The main interface opens again (Note: So button activates Window)... But i created a new Dialog, (Class: CButton01Dlg) (CPP: Button01Dlg.cpp) and when i use the following code it gives me 4 errors, 0 warnings... void CClientDlg::OnButton01() { CButton01Dlg dlg; dlg.DoModal(); } C:\*\ClientDlg.cpp(179) : error C2065: 'CButton01Dlg' : undeclared identifier C:\*\ClientDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier 'dlg' C:\*\ClientDlg.cpp(179) : error C2065: 'dlg' : undeclared identifier C:\*\ClientDlg.cpp(180) : error C2228: left of '.DoModal' must have class/struct/union type Just a Human Trying to Live in a Computers World.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          You probably forgot to include the header file of CButton01Dlg (Button01Dlg.h) in ClientDlg.cpp :).

          N 1 Reply Last reply
          0
          • C Cedric Moonen

            You probably forgot to include the header file of CButton01Dlg (Button01Dlg.h) in ClientDlg.cpp :).

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

            Hahaha... Your Right!!! Thank you Both So very Much! This problem has been driving me crazy all day long... Thanks! :-D Just a Human Trying to Live in a Computers World.

            1 Reply Last reply
            0
            • N NewbieStats

              That Helps So Much! I have one Question tho... Its driving me Crazy... void CClientDlg::OnButton01() { CClientDlg dlg; dlg.DoModal(); } Works Perfectly, If i click on Button01, The main interface opens again (Note: So button activates Window)... But i created a new Dialog, (Class: CButton01Dlg) (CPP: Button01Dlg.cpp) and when i use the following code it gives me 4 errors, 0 warnings... void CClientDlg::OnButton01() { CButton01Dlg dlg; dlg.DoModal(); } C:\*\ClientDlg.cpp(179) : error C2065: 'CButton01Dlg' : undeclared identifier C:\*\ClientDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier 'dlg' C:\*\ClientDlg.cpp(179) : error C2065: 'dlg' : undeclared identifier C:\*\ClientDlg.cpp(180) : error C2228: left of '.DoModal' must have class/struct/union type Just a Human Trying to Live in a Computers World.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              hum, i'd like to answer, even if you already have the solution... C:\*\ClientDlg.cpp(179) : error C2065: 'CButton01Dlg' : undeclared identifier C:\*\ClientDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier 'dlg' C:\*\ClientDlg.cpp(179) : error C2065: 'dlg' : undeclared identifier C:\*\ClientDlg.cpp(180) : error C2228: left of '.DoModal' must have class/struct/union type here is what the compiler says : first error, undeclared identifier. what does this evoque for you ? for me (and the compiler too), it means that the identifier CButton01Dlg is called in a module (cpp file) but the definition of that identifier is not inside it. You so have to help it telling it that it will find such definition in Button01Dlg.h file (for example). So, do this :

              #include "Button01Dlg.h"

              The 3 last error depend on the 1st one. As CButton01Dlg were not defined, the compiler could not do anything with it, so : - could not declare dlg in a type it doesn't know (error C2065), - could not use dlg (error C2228). here it is. hope it will help a bit...


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              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