WINCE MFC程序全屏显示
WINCE下MFC程序(VS2005环境)为了让视频全屏显示采用下面代码
CRect m_FullScreenRect; //全屏区域
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
ClientToScreen(&ClientRect);
int nFullWidth = GetSystemMetrics(SM_CXSCREEN);
int nFullHeight = GetSystemMetrics(SM_CYSCREEN);
m_FullScreenRect.left = WindowRect.left-ClientRect.left;
m_FullScreenRect.top = WindowRect.top-ClientRect.top;
m_FullScreenRect.right = WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.bottom = WindowRect.bottom-ClientRect.bottom+nFullHeight;
this->SetWindowPos(this->GetWindow(GW_OWNER), m_FullScreenRect.left,
m_FullScreenRect.top, m_FullScreenRect.Width(),
m_FullScreenRect.Height(), SWP_SHOWWINDOW);
CWnd *pVideoWnd = (CWnd*)GetDlgItem(IDC_WND_VIDEO);
pVideoWnd->SetWindowPos(pVideoWnd,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_NOOWNERZORDER|SWP_SHOWWINDOW);
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
ClientToScreen(&ClientRect);
int nFullWidth = GetSystemMetrics(SM_CXSCREEN);
int nFullHeight = GetSystemMetrics(SM_CYSCREEN);
m_FullScreenRect.left = WindowRect.left-ClientRect.left;
m_FullScreenRect.top = WindowRect.top-ClientRect.top;
m_FullScreenRect.right = WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.bottom = WindowRect.bottom-ClientRect.bottom+nFullHeight;
this->SetWindowPos(this->GetWindow(GW_OWNER), m_FullScreenRect.left,
m_FullScreenRect.top, m_FullScreenRect.Width(),
m_FullScreenRect.Height(), SWP_SHOWWINDOW);
CWnd *pVideoWnd = (CWnd*)GetDlgItem(IDC_WND_VIDEO);
pVideoWnd->SetWindowPos(pVideoWnd,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_NOOWNERZORDER|SWP_SHOWWINDOW);
上述代码让控件全屏显示
void CXXXDlg::SetScreenMode(BOOL bFullScreen)
{
if (bFullScreen)
{
//查找CamDemo窗口
HWND hWndSIP = ::FindWindow(_T("CamDemo"), NULL);
if ( NULL != hWndSIP )
{
::ShowWindow( hWndSIP, SW_HIDE );
}
//隐藏HHTaskBar窗口代码如下:
HWND hTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (hTaskBar != NULL)
{
::EnableWindow(hTaskBar, FALSE);
::ShowWindow(hTaskBar, SW_HIDE);
}
CRect rcScreen;
rcScreen.SetRect( 0,
0,
GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ));
MoveWindow(&rcScreen, TRUE);
}
else
{
//查找CamDemo窗口
HWND hWndSIP = FindWindow(_T("CamDemo"), NULL)->GetSafeHwnd();
if ( NULL != hWndSIP )
{
::ShowWindow( hWndSIP, SW_SHOW );
}
// 显示任务栏
HWND hWndTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (hWndTaskBar != NULL)
{
::ShowWindow(hWndTaskBar, SW_SHOW);
}
}
}
{
if (bFullScreen)
{
//查找CamDemo窗口
HWND hWndSIP = ::FindWindow(_T("CamDemo"), NULL);
if ( NULL != hWndSIP )
{
::ShowWindow( hWndSIP, SW_HIDE );
}
//隐藏HHTaskBar窗口代码如下:
HWND hTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (hTaskBar != NULL)
{
::EnableWindow(hTaskBar, FALSE);
::ShowWindow(hTaskBar, SW_HIDE);
}
CRect rcScreen;
rcScreen.SetRect( 0,
0,
GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ));
MoveWindow(&rcScreen, TRUE);
}
else
{
//查找CamDemo窗口
HWND hWndSIP = FindWindow(_T("CamDemo"), NULL)->GetSafeHwnd();
if ( NULL != hWndSIP )
{
::ShowWindow( hWndSIP, SW_SHOW );
}
// 显示任务栏
HWND hWndTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (hWndTaskBar != NULL)
{
::ShowWindow(hWndTaskBar, SW_SHOW);
}
}
}
这个函数隐藏标题栏、任务栏