我正在创建Windows上下文菜单的模仿。
显示对话框执行以下操作:
CreateDialogIndirectParam
运行一个消息循环:
while ( ContinueModal() && GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
我在新窗口中找到丢失焦点事件的对话框,我将ContinueModel
标记设置为false并调用EndDialog
/ DestroyWindow
。
EndDialog
不会终止我的对话,DestroyWindow
会这样做。这没关系,有谁可以解释原因?谢谢! d。
答案 0 :(得分:7)
就像它在文档的第一行中所说的那样EndDialog
ends modal dialogs。您的对话框不是模态的,因此EndDialog
功能错误。 The documentation for CreateDialogIndirectParam
说
要销毁对话框,请使用DestroyWindow函数。