在一个MFC多文档应用程序中加了一个校验对话框,我验证成功后,改对话框消除,需要进入原来的进程,不知道为什么进不去了?
这个是调用对话框的源码:
CLicenseDlg dlg;
m_pMainWnd = &dlg;
CLicenseDlg * log = new CLicenseDlg;
if (log->DoModal()!= IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
//str=GetMacAddress();
return FALSE;
}
else
if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
我理解你的需求是:一个应用启动时要进行用户验证,输入用户名密码之类,通过了才能使用,否则应用退出。
你新建个多文档工程,添加个对话框资源,带默认确认、取消按钮那种,再添加我发的图片中的代码。如果再不行就真见鬼了。
if (log->DoModal()!= IDOK)
->
nResponse = log->DoModal();
if (nResponse == IDOK)
...
else
,,,
BOOL CtttApp::InitInstance()
{
CLoginDlg loginDlg;
if(loginDlg.DoModal() != IDOK)
return FALSE;
}