Original link: http://blog.csdn.net/smartgps2008/article/details/7741223
maximize the window without the title bar :
First case: Overriding the taskbar
ShowWindow (sw_showmaximized);
Second case: Don't overwrite the taskbar
int cx = GetSystemMetrics (sm_cxfullscreen);
int cy = GetSystemMetrics (Sm_cyfullscreen);
CRect RT;
SystemParametersInfo (spi_getworkarea,0,&rt,0);
cy = Rt.bottom;
MoveWindow (0, 0, CX, CY);
Maximize the window with the title bar:
First case: Overriding the taskbar
Inside OnSize (UINT nType, int cx, int cy)
if (NType = = size_maximized)
{
This must be GetSystemMetrics (Sm_cxscreen)-1 to show the full screen effect
SetWindowPos (&wndtopmost, 0, 0, GetSystemMetrics (sm_cxscreen)-1, GetSystemMetrics (Sm_cyscreen), 0);
}
Second case: Don't overwrite the taskbar
ShowWindow (sw_showmaximized);
MFC windows with title bar and windows with no title bar maximize