在OnCreate函数最后加上以下代码:
SetWindowLong(this->m_hWnd,GWL_STYLE,WS_DLGFRAME);
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
SetWindowPos(NULL,
0, 0, rect.right - rect.left + rect.Width(),
rect.bottom - rect.top + rect.Height(),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
或者用以下代码:
SetWindowLong(this->m_hWnd,GWL_STYLE,GetWindowLong(this->m_hWnd,GWL_STYLE)&~WS_CAPTION);
SetWindowPos(NULL,NULL,NULL,NULL,NULL,SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
SetWindowPos(NULL,
0, 0, rect.right - rect.left + rect.Width(),
rect.bottom - rect.top + rect.Height(),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
SetWindowPos(NULL,NULL,NULL,NULL,NULL,SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);