Jump to content
  • Advertisement
Sign in to follow this  
lordikon

[C++] WM_SIZE and WM_EXITSIZEMOVE

This topic is 3542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So here is my problem. When resizing my window I need to update the height/width of certain things in the game, but only after the user is done resizing the window, so for that I can use WM_EXITSIZEMOVE. However, I also want the height/width update to occur when a window is maximized or restored (from a maximize back to the previous size). So for this I would use WM_SIZE, and check wparam for either SIZE_MAXIMIZED or SIZE_RESTORED. The problem is that when resizing a window the WM_SIZE message is sent and the wparam is SIZE_RESTORED. So I have no way that I know of to distinguish between when a user is restoring their window or if they're currently resizing their window. If they're in the middle of resizing their window I do not want to do anything because I want to wait for WM_EXITSIZEMOVE to be sent. EDIT: The summary is that I need to be able to know when a window has been restored to previous size from a maximize, but I do not want to know when a window is in the middle of being resized. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
So you say you want to know if the previous window state was maximized? Well, that's exactly what the previous message would have said if it was maximized. Update only if you receive a restored-message when the previous state was maximized by keeping track of the window state.

Share this post


Link to post
Share on other sites
Wow, so windows is just too lazy to differentiate between resizing a window and restoring the size of a window from being maximized?

Thanks for the advice, I guess I might have to start storing the windows state just for this one case that Windows doesn't handle on its own.

Share this post


Link to post
Share on other sites
I just gave you a quick and simple answer given the information you provided. I don't know enough about Win32 to know if you can actually get that information. Of course Windows knows if the size is restored compared to just changed; after all, you pressed the dedicated restore button. Whether it can give you that information, and if so, how, is a different question I don't know the answer to.

Share this post


Link to post
Share on other sites
Yea, windows must know when restore is pressed, I agree. I'm just surprised the the restore parameter in WM_SIZE is sent even when a window is being resized. In fact, the restore parameter is a value of 0, so my guess is that they just pass '0' as the value during a resize.

Anyway, thanks for your help.

Share this post


Link to post
Share on other sites
I haven't checked, but couldn't you just set a flag when WM_ENTERSIZEMOVE is received?
Once WM_SIZE fires you check for the flag. That way you can differentiate between the two cases.
In WM_EXITSIZEMOVE clear the flag again.

Share this post


Link to post
Share on other sites
WM_ENTERSIZEMOVE doesn't have any parameters, so all you know is that the window has either moved, resized, maximized or restored.

I think what I'll have to do is what was already mentioned, set a flag when maximized occurs, and then if I get a restore type of WM_SIZE message after that it must be restoring from a maximize, in which I can just clear the flag.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!