Click to See Complete Forum and Search --> : how can I force a dialog box to disappear and create another


Danielle Harvey
May 12th, 1999, 08:12 PM
I created dialog based application and I have 2 separate modal dialog boxes. If the user
hits ok in the first modal dialog box, I want that modal box to disappear and the other
dialog box to popup, but when I implement the following code;

void Modal::OnOk()
{
DestroyWindow();

CModal1 dlg1;
dlg1.DoModal();
}

both dialog boxes disappear. Is there any way I can specify that I want
just the first modal dialog box to disappear?

Details are cherished. Any response anyone can give me will be greatly
appreciated.

Bob Clarke
May 13th, 1999, 05:12 AM
Use ShowWindow(SW_HIDE) prior to the DoModal call, such as:

void CTwoDlgTestDlg::OnOK()
{
ShowWindow(SW_HIDE);
CDlgTwo dlg;
dlg.DoModal();

CDialog::OnOK();
}