The common one given as an example is to use the Mainframe class's PreCreateWindow function and alter the CREATESTRUCT variable's cx and cy parameters. The problem is that this is only good for program where the height and width are already known.
While I am talking about the CMainFrame::PreCreateWindow function;
Step 8: Remove the style FWS_ADDTOTITLE from the cs.style parameter. This style adds the filename of the saved file the program is displaying or 'Untitled' when starting afresh.
The other place to re-size a program is in the View class's OnInitialUpdate and OnUpdate functions using Window's SetWindowPos(). OnInitialUpdate() is called between the time the Document first connects with the View but before the View is first displayed. OnUpdate() is called by the Document's UpdateAllView() function, which allows the programmer an opportunity to refresh the View on demand.
While there are some differences between the initial and on-demand updates, the bare bones is as follows;
Get the size of the Board. A pass-through function in the Document class should do this as there could be additional information in the Document to be added (not in this case). Reminder, this will be the right-most and bottom-most values, plus the BORDER value in each direction.
Example: The getSize() function from CBoard
CSize CBoard::getSize(void) const
Assert that this instance is not NULL.
Assert that Board's places is not NULL.
If Board's places is NULL, then return an empty CSize value, i.e. CSize(0,0).
Return Size with the right-most value of places[BoardSize-1]+BORDER and the bottom-most value of places[BoardSize * (BoardSize-1)]+BORDER.
The returned size is then adjusted for the GUI.
(For Microsoft) In the X direction this is given by GetSystemMetrics(SM_CXFIXEDFRAME) which is the width of the GUI frame for the thin frame style. (I did say to create the program with the thin frame didn't I?)
The Y direction adjustment is given by the GetSystemMetrics(SM_CYFIXEDFRAME) PLUS GetSystemMetrics(SM_CYCAPTION) (for the caption) PLUS GetSystemMetrics(SM_CYMENU) (for the menu bar). Please Note that this last metric is for single line menus only. (I am still working on multiple line menus.)
Next up, Desktop checks.