如何实现先出现一个选项对话框,确定后,进入主程序?
这是一个基于对话框的程序
在APP的InitInstance函数中想用一个对话框来选择程序的主界面
先用如下代码:
……
AfxMessageBox("1");
CMgtDlg dlg;
m_pMainWnd = &dlg;
AfxMessageBox("2");
int nResponse = dlg.DoModal();
AfxMessageBox("3");
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
if(dlg.stu1==TRUE)
{
AfxMessageBox("4");
}
else
{
AfxMessageBox("5");
}
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
……
但发现AfxMessageBox(1)、(2)能显示,后面几个不能显示,请问为什么?