Sign in to follow this  

Window position and WM_MOVE

This topic is 2814 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

I'm trying to get my game to remember the position of it's window when switching between full screen and windowed. The way I'm currently doing things is that whenever the window is moved in windowed mode I store the X and Y coordinates from the WM_MOVE message, then when I switch to full screen and back I pass those stored coordinates to CreateWindowEx when it creates the windowed mode window. This mostly works but it seems the coordinates I get from the WM_MOVE message are for the top-left of the client area and the coordinates for CreateWindowEx are expected to be for the top-left of the window including the borders. The result is that when I switch from full screen to windowed the window is positioned down and to the right of where I want it equal to the size of the window border :(. Anyone know of a way to fix this?

Share this post


Link to post
Share on other sites
Or simply you could call GetWindowRect right before switching to fullscreen to get the position data.

But shouldn't switching back to windowed mode restore the window position by default? Just like when maximizing/restoring the window. I may be wrong...

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
But shouldn't switching back to windowed mode restore the window position by default? Just like when maximizing/restoring the window. I may be wrong...


I'm creating and destroying the windows to switch from windowed to full screen or back to windowed so unfortunately no. If it can be done without creating and destroying the windows though I'd love to know how.

At any rate your suggestion about the window rect led me to look at the data and luckily for me the top and left values of it can just be added to the position to get what I want, thanks :).

Share this post


Link to post
Share on other sites

This topic is 2814 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this