怎样在主对话框打开之前先打开一个登录对话框?

来源:百度知道 编辑:UC知道 时间:2024/07/02 13:03:28
我的主对话框没有initinstance(),只有OnInitDialog(),我把登录对话框的打开语句放在OnInitDialog()中,能弹出登录对话框,但问题是这里必须要连接数据库核对用户名和密码,在这里连接数据库的话会不会和主对话框的连接冲突?抑或是与主对话框共用一个连接?还有,如果验证用户名密码错误之后如何正常退出?

BOOL CXXXApp::InitInstance()
中处理
如果验正错误直接return false;


CDlgDlg 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
}
之前处理

?我的主对话框没有initinstance(),只有OnInitDialog(),我把登录对话框的打开语句放在OnInitDialog()中,能弹出登录对话框,但问题是这里必须要连接数据库核对用户名和密码,在这里连接数据库的话会不会和主对话框的连接冲突?抑或是与主对话框共用一个连接?还有,如果验证用户名密码错误之后如何正常退出?

BOOL CXXXApp::InitInstance()
中处理
如果验正错误直接return false;


CDlgDlg 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