首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

关于主窗口解决办法

2012-06-07 
关于主窗口求助:mfc对话框应用程序,在主窗口dlg1点击菜单项以DoModal方式弹出一新对话框(dlg2),如何销毁dl

关于主窗口
求助: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    }} 

热点排行