阅读这篇文章后,我的脑海里出现了这个问题: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/