Is there any way to enforce a minimum size (width and height) on a window?
I’ve seen applications that don’t allow the resizing of their windows below a point, and do it without flickering or anything. Also if the resolution was below those minimums, they wouldn’t allow maximizations, and would instead restore themselves to filling the screen but never maximized.
How can this be achieved?
I haven’t done this myself, but something like this should work:
Basically, if the rectangle the window is going to be exceeds the maximum width or height, it adjusts it and sends it on, so it shouldn’t cause flickering. Again, I’ve never tried this, so I’m not completely sure.
As Luke points out, you can save a lot of work by handling
WM_GETMINMAXINFOto set the defaults instead of reinventing the wheel.