winapi - How does a modal dialog's message-pump interact with the main application message-pump? -
My understanding is in any form, automatically its message pump, that dialog is running on a dedicated thread - this is right ?
If so, how does the existence of the model dialogue affect the message loop of the main application? Do both walk in parallel, does one take priority?
I have a situation where a model dialogue is waiting for several seconds, and it is possible that the dialogue has to wait till the main application thread is busy? As the second spectacle is explained, the modal dialog will run in the same thread, called the caller. So if you run the dialog from the main UI thread that contains your main loop, you will end up with the nested message loop. The stack will look something like this:
WinMain yourMainMessageLoop Dispatches SomeMessageHandler DoModal
and DoModal
your own GetMessage spin in
/ translation message
/ dispatch message
loop main message loop ( YourMainageLoop
in the sample stack given above) Active "that it is still running, but the message of the dialogue does not exit blocked is executing YourMainageLoop
until DoModal
.
Note that even if you are within the message loop of the modal dialog, your other windows still handle messages because because GetMessage
and DispatchMessage
then Will also retrieve those windows and send them directly and their WndProc
s.
Comments
Post a Comment