How to save state of dialog so that it not closed?

Hi!
I design mfc dialog based application in which first i design main parent window containing multiple child windows with tab control,it works fine.After i add one dialog before parent dialog and call parent dialog from it.So call to new dialog insert Back button on parent dialog,it works well,but second time parent dialog failed to open and application close.So how to save state of parent dialog second time initialization.I used methodlogy for above scenario given below:
I call new dialog in OnInitDialog() of parent dialog as DoMOdal() method.
Back button code given below:
1
2
3
4
5
6
7
void CParent::OnBnClickedBack()
{
    UpdateData(TRUE);
    NewDlg dlg=new NewDlg();
    OnOK();
    dlg.DoModal();
}
Topic archived. No new replies allowed.