Hi ,
I'm trying to create a dialog based application.
There are 2 MFC classed inherited from CDialog their names;
MFC_Dialog -- This is main dialog
SecondDialog,
What am i trying is this ;
There's a button on MFC_Dialog ,when i click button SecondDialog shall open ,
and when i click the button on SecondDialog, it shall close , and return main dialog again.
And i wrote following codes ;
This is function for the button on main dialog
1 2 3 4 5
|
void CMFC_2DialogDlg::OnBnClickedOk()
{
SecondDialog dlg ;/// CMFC_2DialogDlg dlg;
INT_PTR nResponse = dlg.DoModal();
}
|
And this is the method on SecondDialog
1 2 3 4 5 6
|
// SecondDialog message handlers
void SecondDialog::OnBnClickedOk()
{
CMFC_2DialogDlg dlg ;
INT_PTR nResponse = dlg.DoModal();
}
|
Well, this works but it creates a new dialog without destroying current dialog.
As a result, many dialog occurs.
What i want is , to destory current dialog and create a new one.
How can i do it ?
Thanks in advance,