Sign in to follow this  

Minimum window dimensions.

Recommended Posts

Some (windowed) games have it so that you cannot reduce the size of the window past a certian point. Since my game produces the always amusing "Divide by zero" error if shrunken too far, I used the SetWindowPos function to cap it. The problem is, resizing is ugly. Using SetWindowPos function still shows the frame being shrunken inwards, even though the window is never that small, inaddition it causes flicckery refreshes. There has got to be a better way... [bawling] (Win32 btw)

Share this post

Link to post
Share on other sites
Original post by Shannon Barber
Check for 0 and do nothing.
Or if you really want to stop the resize, you have to dig deeper into the message pump, WM_SIZE or WM_RESIZE is a place to start.

I don't understand: I've never heard of WM_RESIZE, and I don't know what to check for zero.

My SetWindowPos resides in the WM_SIZE message.

Edit: Oh, you mean check for the divide by zero, I was thinking towards the return value of SetWindowPos. This would work, but I really want to limit the window size.

Share this post

Link to post
Share on other sites
Found it...

gpWindowSettings = lParam;
gpWindowSettings->ptMinTrackSize.x = 800;
gpWindowSettings->ptMinTrackSize.y = 600;
return 0;

Where gpWindowSettings is a global pointer to a "MINMAXINFO Structure".

Now I get a professional looking restraint on my window. xD

Share this post

Link to post
Share on other sites

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