Non-resizable window.
-
How do I go about keeping my form-view based app from being resized, I'd also like to hide the maximize/restore restore button....
-
How do I go about keeping my form-view based app from being resized, I'd also like to hide the maximize/restore restore button....
Try catching the WM_SIZE/WM_SIZING message but don't resize anything. I don't know how to hide the maximize/restore button. Here are a couple links you may find interesting: OnSizing http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/\_mfc\_cwnd.3a3a.onsizing.asp OnSize http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/\_mfc\_cwnd.3a3a.onsize.asp Hope that helps.
-
How do I go about keeping my form-view based app from being resized, I'd also like to hide the maximize/restore restore button....
You need to remove a couple of window style flags from the main frame: WS_THICKFRAME and WS_MAXIMIZEBOX. The easiest way to do this in MFC is to override CWnd::PreCreateWindow().
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
return TRUE;
}-------------- "Aagh!! I'm a victim of a Random Act of Management!"
-
How do I go about keeping my form-view based app from being resized, I'd also like to hide the maximize/restore restore button....
Ulf is on the right track. However, I like the thick frame style so I take a somewhat backdoor approach. Catch the WM_NCHITTEST message (I think it is), which is the non-client hit test and tell the OS that it never hits the corners or sides. If you don't want it to be unmoveable then don't "let" it hit the title bar. This way, you can have a standard appearance but the window will be non-resizable and unmovable.
-
Ulf is on the right track. However, I like the thick frame style so I take a somewhat backdoor approach. Catch the WM_NCHITTEST message (I think it is), which is the non-client hit test and tell the OS that it never hits the corners or sides. If you don't want it to be unmoveable then don't "let" it hit the title bar. This way, you can have a standard appearance but the window will be non-resizable and unmovable.
I agree that apps look better with the thick border style. Catching WM_NCHITTEST is not 100% foolproof, though. It prevents the user from resizing the window, but Windows can still resize it (if the user, for example, clicks "Tile windows" from the task bar). Also, if the window has a status bar, it can be resized with the status bar's gripper. These problems can be solved by catching WM_GETMINMAXINFO and setting the window's min and max tracking sizes. -------------- "Aagh!! I'm a victim of a Random Act of Management!"