#调用无模式对话框
方法1:
void Test1() //CMyNewDlg 窗口名称
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
AfxEnableControlContainer();
if (dlg != NULL)
delete (dlg);
dlg = new CMyNewDlg();
dlg->Create(IDD_DIALOG1);
dlg->ShowWindow(SW_SHOW);
}
方法2:
CMyDialog 3 pDialog ;//CMyDialog 窗口名称
static void TestDialog()
{
pDialog = new CMyDialog();
if (pDialog ! = NULL)
{
BOOL ret =pDialog →Create( IDD_MYDIALOG,NULL);
∥创建无模式对话框;
if (!ret)
AfxMessageBox("Error Creating Dialog");
pDialog →ShowWindow(SW_SHOW);
∥强制显示;
}
else
AfxMessageBox("Error Creating Dialog Object") ;
}