简体   繁体   English

多个顶层窗口

[英]multiple top-level windows

A single threaded Win32 GUI application has multiple top-level windows. 单线程Win32 GUI应用程序具有多个顶级窗口。 In a message handler for one of the windows, it displays a modal dialog (for example, by using the MessageBox function). 在其中一个窗口的消息处理程序中,它显示一个模式对话框(例如,通过使用MessageBox函数)。 The other windows in the application still work as usual, even though the only thread in the application is waiting for the modal dialog result. 即使应用程序中的唯一线程正在等待模式对话框结果,应用程序中的其他窗口仍照常工作。

how does this behavior work? 这种行为如何运作?

A modal dialog is a dialog which disables it's owner and enters a message loop until it is closed. 模态对话框是一个对话框,它禁用它的所有者并进入消息循环直到关闭。 When it is closed, the calling function receives the dialog result code, and execution returns to the thread message loop (or the previous modal dialog). 当它关闭时,调用函数将接收对话框结果代码,然后执行返回线程消息循环(或上一个模式对话框)。

Since it is executing a message loop, other windows in the thread will continue to receive messages. 由于它正在执行消息循环,因此线程中的其他窗口将继续接收消息。

Ie the other windows continue to work because the modal dialog is dispatching their messges. 也就是说,其他窗口继续工作,因为模式对话框正在分发其消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM