c++ - 为什么 MFC 中的模式对话框实际上在内部是无模式的?

标签 c++ visual-c++ mfc

阅读这篇文章后,我的脑海里出现了这个问题:http://www.codeproject.com/Articles/3911/The-singular-non-modality-of-MFC-modal-dialogs .他提到 MFC 中的模态对话框不是严格意义上的模态对话框,而是作为非模态对话框(在内部)实现的,带有花里胡哨的功能,使其表现得像模态对话框。

具体来说,他说:

The MFC command routing mechanism uses a combination of message maps and virtual functions to achieve what it does and a true modal dialog will totally wreck this mechanism because then the modal message loop is controlled outside the scope of the MFC command routing machinery

谁能解释一下这个说法?如果他们尝试实现一个真正的模态对话框会出现什么错误,举个例子可以大大澄清问题。

最佳答案

模态对话框会停止消息循环,但仍必须有一个消息循环来处理对话框的事件。因此模态对话框只是一个具有自己的内部消息循环的非模态对话框。

关于c++ - 为什么 MFC 中的模式对话框实际上在内部是无模式的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12297052/

相关文章:

c++ - 从 MFC 调用 ATL COM dll

c++ - 如何遍历 CListCtrl 的元素?

c++ - 从基于两个变量的结构 vector 中获取 min_element

c++ - 与 Hudson 的持续集成和自动化测试 QWidgets

c++ - 在 C++ 类中折叠断言?

c++ - C++ 是否仍积极用于通用开发?

c++ - 为什么 _Printf_format_string_ 宏不产生任何警告?

visual-c++ - 在 VC++ 6 中创建新的连接点?

c++ - 为什么编译器不会拒绝以加法运算符开头的行?

c++ - 在 msgbox 中显示当前系统时间