Thank you for the interesting question. You should handle
WM_GETMINMAXINFO in your main frame class so that you can limit its minimum size when resizing. You can get the minimum size using the following code
CMainFrame * pMainFrame = . . .
CRect rcFrameWnd, rcInnerAreaWhichIsFreeOfAnyBars;
pMainFrame->GetWindowRect( &rcFrameWnd );
pMainFrame->GetDlgItem( AFX_IDW_PANE_FIRST )->GetWindowRect( &rcInnerAreaWhichIsFreeOfAnyBars );
CSize sizeMainFrame = rcFrameWnd.Size();
CSize sizeSdiViewOrMdiClientArea = rcInnerAreaWhichIsFreeOfAnyBars.Size();
CSize sizeMinimalToShowAllBars = sizeMainFrame - sizeSdiViewOrMdiClientArea;
should be specified as the minimum acceptable size for your main frame window in its
message handler method. The
rectangle can also be computed using the
method with the
constant in one of its parameters.
This approach should meet your requirements if your main frame has only the following type of control bars:
1) The persistently non-redockable control bars like the status bar.
2) The control bar like windows which take up some part of main frame’s client area persistently like MDI tabs and grouped auto-hide areas for resizable control bars.
If your main frame window has a
menu control bar, it can re-organize its buttons into a larger number of rows if the menu bar’s width is enough condensed. If you have several
tool control bar windows docked into one row, then this row can be converted into 2, 3 and more rows if it’s not possible to layout all the bars in one row. The same is true for vertically a docked menu bar and toolbars andfor
panel bars if you have such bars in your project. This means the
size value cannot be enough large to fit all bars due to layout behavior of the menu bar and toolbars. You can simply increase it by a few pixels horizontally/vertically so everything will be OK. If you have enough large number of toolbars, then exact computation of the
is hardly possible.