I want to communicate between two or more dialog windows,when i say communicate It means that I want to use the variables and functions in all dialog boxes with values updated.. So what I did is created three main Dialog boxes,Considering 1 dialog window as main window where it can have variables and functions and I created a pointer variable for the maindialog in other windows..to access the variables and function which are in the mainwindow...please check the below code if its not clear....
first dialog class
//header
class MainDialog;
class FirstDialog : public CDialog
{
DECLARE_DYNAMIC(FirstDialog)
public:
FirstDialog();//standard constr
FirstDialog(MainDialog* pfirstPage);//constructor that i defined
protected:
MainDialog* firstPage;
};
//cpp
intializing the constructor
FirstDialog::FirstDialog(MainDialog* pFirstPage)
: CDialog(FirstDialog::IDD)
,firstPage(pFirstPage)
{
}
similarily SecondDialog Class....
now i did the following
MainDialog main(L"Main Dialog");
FirstDialog dialog1(&main);
SecondPage dialog2(&main);
m_pMainWnd = &dialog1;
INT_PTR nResponse = dialog1.DoModal();
so the problem is, Say if I have a CString variable in maindialog..I can call that variable and assign value in the first Dialog...but when I tried to access that value in the secondDialog..it restricts..there's no value..Please let me know if you are not able to understand..