如何依据一定的条件显示哪个对话框?
在应用程序的InitInstance中,依据我的记录集是否为空,来判断显示哪一个对话框
BOOL Cfirstproject1App::InitInstance()
{
if(dataoperation->IsEmpty())
Cfirstproject1Dlg dlg;
else
CLoginDlg dlg;
//m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
}
这样编译之后报错:dlg没有定义!
为什么呢?应该怎么做呢!
[解决办法]
变量作用域问题
Cfirstproject1Dlg dlg1;CLoginDlg dlg2;INT_PTR nResponse;if(dataoperation->IsEmpty())nResponse = dlg1.DoModal();elsenResponse = dlg2.DoModal();