我的程序有部分代码如下:
现在我只能做出两个判断要么nResponse == IDOK要么nResponse == IDCANCEL,可是如果我的有一个button1在dlg上,我如何得到这个消息呢?nResponse应该==什么呢?本人是初学vc望各位大侠说的详细一点,谢谢!
CMyDialog 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
}
现在我只能做出两个判断要么nResponse == IDOK要么nResponse == IDCANCEL,可是如果我的有一个button1在dlg上,我如何得到这个消息呢?nResponse应该==什么呢?本人是初学vc望各位大侠说的详细一点,谢谢!
CMyDialog 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
}
只有关闭对话框才有Response
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
}
是在对话框关闭后才执行的,对Button1的处理放在CMyDialog里边。