最简便的方法就是:
定义一全局变量int flag;
然后在InitInstance()里(即在主对话框没显示之前的函数里)
flag=0;
while(flag>=0)
{
if(flag==0)
{
CIceDispImgDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.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
}
}
else if(flag ==1)
{
CIceNewDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.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
}
}
else
{
break;
}
}
在互相调用前,设置flag=0或=1,然后退出本身对话框即可