MFC基于对话框的Media Player如何实现全屏显示功能?

MFC基于对话框的Media Player如何实现全屏显示功能?

BOOL CPlay::SwitchFullScreen(BOOL bFullScreen)
{
    CWnd* parentWnd = this->GetParent();
    if ( NULL == m_ParentWnd && parentWnd != this->GetDesktopWindow())
    {
        m_ParentWnd = parentWnd;
    }

    if (bFullScreen)
    {
        this->SetParent(NULL);
        ::SetWindowPos(this->GetSafeHwnd(), HWND_TOPMOST,-1,-1,-1,-1, SWP_NOMOVE|SWP_NOSIZE);
        this->ShowWindow(SW_MAXIMIZE);       
    }
    else
    {
        this->ShowWindow(SW_RESTORE);
        ::SetWindowPos(this->GetSafeHwnd(), HWND_TOPMOST,-1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
        CRect parentBounds;
        m_ParentWnd->GetClientRect(parentBounds);

        this->SetParent(m_ParentWnd);
        this->MoveWindow(parentBounds);        
    }

    bFullScreen = !bFullScreen;
    
    return bFullScreen;
}
				



你可能感兴趣的:(VC++/VC#相关技术)