Skip to main content
GameDev.net gamedev.net
🔒 Locked

Why does application halts when moving dialogs?

Started by floatingwoods Dec 9, 2008 at 6:19 PM 2 replies 550+ views
Original Post
floatingwoods
floatingwoods
Hello, The question might be trivial, but there is an annoying thing about my application: when I move with the mouse any window or dialog belonging to my application, the windows message queue seems to be fully concentrated into that task (the application is stuck somewhere in the PeekMessage-TranslateMessage-DispatchMessage routine). Same happens when navigating the window's menus, during a window resizing action, etc. Can someone explain me why this is and if there is a way around this? (without using another thread) . My application is running a simulation that displays graphics that come to a halt in those situations. Or, is there a signal that I could track that will tell me: "We are going to enter such a situation now"?
Codeka
Codeka
You want to look into modal messages loops, because that's what's happening here. When you show a modal dialog (e.g. a MessageBox or a menu) the dialog itself "takes over" the message pump. If you want to continue processing during that time, you'll want to set up a WM_TIMER, or handle WM_PAINT or something like that. Or, as you say, do the graphical processing in another thread.
floatingwoods
floatingwoods
Thank you for the reply. Does that mean that when I am moving with the mouse a non-modal dialog a kind of modal state is started for some time? Is there a signal (e.g. WM_...) that triggers that state?
Codeka
Codeka
Quote:
Original post by floatingwoods
Thank you for the reply. Does that mean that when I am moving with the mouse a non-modal dialog a kind of modal state is started for some time? Is there a signal (e.g. WM_...) that triggers that state?


Well, youy window will receive the WM_NCLBUTTONDOWN notification when you hold down the left-mouse button on a non-client area (you then have to work out whether they're inside the caption rectangle or somewhere else, etc). You can also use a simliar mechanism for when the user clicks the "Move" menu item from the Alt+Space menu (I don't know the proper name for it...)

Anyway, I'd suggest you try to work around this problem another way, because there's lots of ways you can find yourself in a modal message loop (as I said, MessageBox does it, ShowDialog of course, also resizing the window and so on).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.