Question under MFC...
-
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. -
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. -
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]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. -
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.You probably forgot to include the header file of CButton01Dlg (Button01Dlg.h) in ClientDlg.cpp :).
-
You probably forgot to include the header file of CButton01Dlg (Button01Dlg.h) in ClientDlg.cpp :).
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.
-
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.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 inButton01Dlg.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]