1.禁用最小化按钮:
//获得窗口风格
Style = ::GetWindowLong(m_hWnd,GWL_STYLE);
//设置新的风格
Style &= ~(WS_MINIMIZEBOX);
::SetWindowLong(m_hWnd,GWL_STYLE,Style);
GetWindowRect(&Rect);
//重画窗口边框
::SetWindowPos(m_hWnd,HWND_TOP,Rect.left,Rect.top,Rect.Width(),Rect.Height(),SWP_DRAWFRAME);
2.使最大化按钮有效:
//获得窗口风格
Style = ::GetWindowLong(m_hWnd,GWL_STYLE);
//设置新的风格
Style |= WS_MAXIMIZEBOX;
::SetWindowLong(m_hWnd,GWL_STYLE,Style);
GetWindowRect(&Rect);
//重画窗口边框
::SetWindowPos(m_hWnd,HWND_TOP,Rect.left,Rect.top,Rect.Width(),Rect.Height(),SWP_DRAWFRAME);