# Minimum window dimensions.

## Recommended Posts

Thevenin    270
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 on other sites
Shannon Barber    1681
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.

##### Share on other sites
Thevenin    270
Quote:
 Original post by Shannon BarberCheck 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 on other sites
Thevenin    270
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