MFC中怎么在应用程序运行时先弹出一个对话框 最好有重要部分的代码
4个回答
展开全部
#endif
COpenDatDlg 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
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
在.cpp中把COpenDatDlg dlg换成你自己的对话框类就可以了
COpenDatDlg 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
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
在.cpp中把COpenDatDlg dlg换成你自己的对话框类就可以了
展开全部
在 app init里面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
说明:
在程序的 InitInstance 函数中这样做。
clogoin 程序运行先出现这个窗口
如果(iret == IDOK) 则 domodal主窗口,即m_pMainWnd。
不知道能不能看明白。
BOOL CChargeApp::InitInstance()
{
AfxEnableControlContainer();
CLogoin logoindlg;
int iret = logoindlg.DoModal();
if (iret == IDOK)
{
CChargeDlg 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
}
}
return FALSE;
}
在程序的 InitInstance 函数中这样做。
clogoin 程序运行先出现这个窗口
如果(iret == IDOK) 则 domodal主窗口,即m_pMainWnd。
不知道能不能看明白。
BOOL CChargeApp::InitInstance()
{
AfxEnableControlContainer();
CLogoin logoindlg;
int iret = logoindlg.DoModal();
if (iret == IDOK)
{
CChargeDlg 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
}
}
return FALSE;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看你要运行到哪一步了。
messagebox 你查查 很好用的
messagebox 你查查 很好用的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询