Minimum window dimensions.

Started by
2 comments, last by Thevenin 18 years, 9 months ago
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)
Advertisement
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.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Quote: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.
Found it...

		case WM_GETMINMAXINFO:			gpWindowSettings = lParam;			gpWindowSettings->ptMinTrackSize.x = 800;			gpWindowSettings->ptMinTrackSize.y = 600;			return 0;		break;


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

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

This topic is closed to new replies.

Advertisement