实用的全屏切换(ZZ)
void CMainFrame::FullScreen()
{
m_bFullScreen=!m_bFullScreen;
LONG style = ::GetWindowLong(this->m_hWnd,GWL_STYLE);
if(m_bFullScreen)//
{
style &= ~(WS_DLGFRAME | WS_THICKFRAME);
SetWindowLong(this->m_hWnd,GWL_STYLE, style);
this->ShowWindow(SW_SHOWMAXIMIZED);
//* xp+sp2下可以不用
CRect rect;
this->GetWindowRect(&rect);
::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left-1, rect.top-1, rect.right-rect.left + 3, rect.bottom-rect.top + 3, SWP_FRAMECHANGED);
//*/
}
else
{
style |= WS_DLGFRAME | WS_THICKFRAME;
SetWindowLong(this->m_hWnd, GWL_STYLE, style);
this->ShowWindow(SW_NORMAL);
}
}
{
m_bFullScreen=!m_bFullScreen;
LONG style = ::GetWindowLong(this->m_hWnd,GWL_STYLE);
if(m_bFullScreen)//
{
style &= ~(WS_DLGFRAME | WS_THICKFRAME);
SetWindowLong(this->m_hWnd,GWL_STYLE, style);
this->ShowWindow(SW_SHOWMAXIMIZED);
//* xp+sp2下可以不用
CRect rect;
this->GetWindowRect(&rect);
::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left-1, rect.top-1, rect.right-rect.left + 3, rect.bottom-rect.top + 3, SWP_FRAMECHANGED);
//*/
}
else
{
style |= WS_DLGFRAME | WS_THICKFRAME;
SetWindowLong(this->m_hWnd, GWL_STYLE, style);
this->ShowWindow(SW_NORMAL);
}
}