在基于对话框的MFC程序中实现视频播放的功能,其中使用了一个CStatic控件来显示摄像头的视频。现在想实现视频全屏显示的功能。使用下面的代码可以实现全屏播放,但是退不出来,也就是回不到全屏显示前的窗口显示状态。 CWnd *saveParent=m_staticVideo.GetParent();
         m_staticVideo.SetParent(GetDesktopWindow());
CRect rect;
GetDesktopWindow()->GetWindowRect(&rect);
 
         m_staticVideo.SetWindowPos(&wndTopMost,rect.left,rect.top,rect.right,rect.bottom,SWP_SHOWWINDOW);请高手们赐教,谢谢!

解决方案 »

  1.   

    //恢复代码m_staticVideo.SetParent(对话框类指针);m_staticVideo.SetWindowPos(&wndTop,m_Rect.left,m_Rect.top,m_Rect.right,m_Rect.bottom,SWP_SHOWWINDOW);::SendMessage(对话框窗口句柄, WM_SYSCOMMAND, SC_RESTORE, NULL);//其中m_Rect为静态控件在原来对话框中的初始大小,你可以在对话框onInitDialog中初始化它
    m_staticVideo.GetWindowRect(&m_Rect);
    ScreenToClient(&m_Rect);
      

  2.   

    恢复时要把父窗口设置原来的,然后updata以下::SetParent(m_staticVideo->GetVideoWnd(), m_hWnd);
    UpdateLayout();