-
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?
Code:
void CClientDlg::OnButton01()
{
/*How do i Link it to Button01.cpp or IDD_Dialog1?*/
}
-
Code:
void CClientDlg::OnButton01()
{
CMyOtherDlg Dlg;
if(Dlg.DoModal() == IDOK)
{
//Handle whatever
}
}
-
Code:
void CClientDlg::OnButton01()
{
/* CClientDlg (ID: IDD_CLIENT_DIALOG)
(CPP: ClientDlg.cpp)
Button01 (ID: IDD_DIALOG1)
(CPP: Button01.cpp) */
/* CMyOtherDlg Dlg;
if(Dlg.DoModal() == IDOK)
{
//Handle whatever
} */
IDD_DIALOG1 Dlg;
if(Dlg.DoModal() == IDOK)
{
//Handle whatever
}
}
3 Errors, 0 Warnings...
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
-
It cant be a resource ID, it needs to be a full MFC class derived from CDialog.
-
Thanks i fixed the problem...
Code:
#include "Button01Dlg.h"
void CClientDlg::OnButton01()
{
CButton01Dlg dlg;
dlg.DoModal();
}
But Ive come to Notice that only Text can be added to the CButton01Dlg on interface... I was wondering if there was a way to somehow get printf or cout working in Button01Dlg.cpp in order to apply variables?...
-
Just pointing out that: this is a C++ forum, and although your questions are about C++, the questions you are asking are related to what's called "windows programming". On this site, there is actually a "windows programming" forum for such questions that you might want to consider next time.