1. Modify the precreatewindow () function as follows:
Bool cmainframe: precreatewindow (createstruct & CS)
{
If (! Cframewnd: precreatewindow (CS) return false;
CS. dwexstyle & = ~ Ws_ex_clientedge;
CS. Style & = ~ Ws_maximizebox; // disable window Maximization
CS. Style & = ~ Ws_minimizebox; // disable window Minimization
// CS. Style & = ~ Ws_sysmenu; // cancel the button on the title
CS. Style & = ~ Ws_thickframe; // The window size cannot be changed with the mouse
CS. lpszclass = afxregisterwndclass (0 );
Return true;
}
2. Change the default window size of vc2010 MFC
2. 1. Because vs2010 will write some information into the registry, this is not the same as vs2005 and vs2008 (excluding SP1). The default SDI and MDI are some BCG-related items.
To modify the window size, you can directly change the window size in the initinstance of the app class before showwindow () and updatewindow (), for example, m_pmainwnd-> movewindow (crect (100,100,600,400), false );
2.2 Application of MFCProgramThere are many differences between the wizard in vc6.0 and vs2010. The MFC Application Wizard in vs2010 adds many new options. By default, when an MFC application is created, the size of the Cx and Cy windows remains unchanged in precreatewindow, in the second step of the vs2010 MFC Application Wizard, select the MFC standard, and in step 6th select the classic menu. The effect is the same as that produced by vc6.0.
To sum up:
Write the followingCode:
M_pmainwnd-> movewindow (100, 50,110 0, 550, false );
You can modify the default window size.