网上介绍ActiveX视频空间全屏的文章很多,我借鉴了一些代码,作了些自己的修改,如下:
点播放窗口右键
1.把嵌入在ActiveX里有窗体“跳”出来
2.隐藏任务栏
再次点击和上面相反,又回到了这个ActiveX里去了
bool m_bFullScreen=false;
HWND m_hWndParent;
CRect m_rcCtrlRect;
void CDlgMain::fullScreen()
{
m_bFullScreen=!m_bFullScreen; // 设置全屏显示标志
if(m_bFullScreen)//全屏显示
{
//用MFC隐藏系统任务栏
CWnd * wnd = FindWindow("Shell_TrayWnd",NULL);
wnd->SetWindowPos(NULL,0,0,0,0,SWP_HIDEWINDOW);
GetWindowRect(m_rcCtrlRect);
m_hWndParent=::GetParent(m_hWnd);
::SetParent(m_hWnd,::GetDesktopWindow());
int nScreenWidth=GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight=GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,nScreenWidth,nScreenHeight
,SWP_FRAMECHANGED|SWP_DEFERERASE);
}
else
{
//用MFC显示系统任务栏
CWnd * wnd = FindWindow("Shell_TrayWnd",NULL);
wnd->SetWindowPos(NULL,0,0,0,0,SWP_SHOWWINDOW);
::SetParent(m_hWnd,m_hWndParent);
CPoint LeftTop(m_rcCtrlRect.TopLeft());
CPoint BottomRight(m_rcCtrlRect.BottomRight());
::ScreenToClient(m_hWnd,&LeftTop);
::ScreenToClient(m_hWnd,&BottomRight);
::MoveWindow(m_hWnd,LeftTop.x,LeftTop.y,m_rcCtrlRect.Width()
,m_rcCtrlRect.Height(),TRUE);
::SetWindowPos(m_hWnd,HWND_NOTOPMOST,0,0,0,0
,SWP_NOMOVE|SWP_NOSIZE);
}
}