关于主窗口
求助:mfc对话框应用程序,在主窗口dlg1点击菜单项以DoModal方式弹出一新对话框(dlg2),如何销毁dlg1,使dlg2成为m_pMainWnd。谢谢帮忙!
[解决办法]
其实很简单:
- C/C++ code
extern CGoDlg2App theApp;//void CGoDlg2Dlg::OnButton1() { // TODO: Add your control notification handler code here EndDialog(0);//Similar within app.cpp CDialog2 dlg2; theApp.m_pMainWnd = &dlg2; int nResponse = dlg2.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel }}