我正在尝试通过代码关闭对话框(基本上派生自属性表类)。以下是我的代码:
LRESULT CSettingsSheet::OnCloseSettings(WPARAM wParam, LPARAM lParam)
{
EndDialog(IDCANCEL);
return 0;
}
问题是 endDialog 不仅会终止对话框,还会终止主应用程序窗口。这个问题的原因可能是什么?
顺便说一句,我在主窗口中创建了这个对话框,如下所示
if(settingsSheet.DoModal() == IDOK)
{
}
else
{
}
理想情况下,我应该使用 IDCANCEL 设置此 domodal 值,而不是调用结束对话框。
谢谢, 库拉姆。
最佳答案
您需要发送PSM_PRESSBUTTON message到属性表窗口:
Simulates the selection of a property sheet button. You can send this message explicitly or by using the PropSheet_PressButton macro.
PSBTN_CANCEL
- Selects the Cancel button.
PSBTN_OK
- Selects the OK button. This value is not valid when using the Aero wizard style (PSH_AEROWIZARD).
关于c++ - 如何以编程方式结束对话框(i.n 属性表),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19131074/