Okay basically I have an MFC application with lots of dialogs that need to be cycled through. Basically when you click one button to go to another dialog, I want the previous dialog to close. Right now the dialogs are just displayed over the top of each other. How do I get the dialog to close once the new dialog has opened? Here is some example code:
void CMachine2Dlg::OnBnClickedNewmc()
{
NameDlg Dlg;
Dlg.DoModal()
}
What you can do is hide the parent dialog when you
DoModal()the new dialog and destroy it after the new dialog ends. I have not tested theShowWindow()below but you get the idea, if it doesn’t hide the dialog look for another similar function.