whisht

    十年

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
HWND m_hWndParent;
BOOL m_fullscreen;
void CDialog::SwitchFullScreen(void)
{
	LONG style = ::GetWindowLong(this->m_hWnd, GWL_STYLE);
	if (m_fullscreen == false)
	{		
		//隐藏系统任务栏
        CWnd * wnd = FindWindow("Shell_TrayWnd",NULL);
        wnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW);

        m_hWndParent = ::GetParent(m_hWnd);   
        ::ShowWindow(m_hWndParent, SW_HIDE);   
        ::SetParent(m_hWnd, NULL);   
        style &= ~(WS_DLGFRAME | WS_THICKFRAME);
        SetWindowLong(this->m_hWnd,GWL_STYLE, style);
        this->ShowWindow(SW_SHOWMAXIMIZED);

        int cx = ::GetSystemMetrics(SM_CXSCREEN);  
		int cy = ::GetSystemMetrics(SM_CYSCREEN);   
		MoveWindow(0, 0, cx, cy, TRUE);
	}
	else
	{ 
		//显示系统任务栏
        CWnd * wnd = FindWindow("Shell_TrayWnd",NULL);
        wnd->SetWindowPos(NULL,0,0,0,0,SWP_SHOWWINDOW);

        style |= WS_DLGFRAME | WS_THICKFRAME;
        SetWindowLong(this->m_hWnd, GWL_STYLE, style);
        ::SetParent(m_hWnd, m_hWndParent);   
        ::ShowWindow(m_hWndParent, SW_SHOW);  
	}
	m_fullscreen = !m_fullscreen;
}
posted on 2012-01-11 16:45  WHISHT  阅读(270)  评论(0编辑  收藏  举报