Created a simple mfc project, then create three dialog and add CDialog class.
TestA, TestB, TestC classes.
In the main frame dialog,
void CMFCApplication3Dlg::OnBnClickedButton1() {
TestA *a = new TestA(CWnd::FromHandle(GetSafeHwnd()));
a->Create(TestA::IDD, CWnd::FromHandle(GetSafeHwnd()));
a->ShowWindow(SW_SHOW);
}
void CMFCApplication3Dlg::OnBnClickedButton2() {
TestB b;
b.DoModal();
AfxMessageBox(L"B closed");
}
Class TestA has,
void TestA::OnBnClickedButton1() {
TestC c;
c.DoModal();
AfxMessageBox(L"C closed");
}
The problem is occur when
- Open TestA
- Open TestB
- Open TestC
Now when i close TestB the AfxMessageBox(L"B closed"); is not run until i close TestC dialog.
Why is this happen?