Mfc implements the player function. Double-click full screen and then double-click to restore

Source: Internet
Author: User

Video Player production and video stream display on static controls, similar to the implementation of double-click full screen operations by thunder
 
In the. h file of the Main Window
[Cpp]
BOOL m_isFullScreen;
CRect m_Old;
BOOL PreTranslateMessage (MSG * pMsg );
 
Nbsp; afx_msg void OnDoubleStatic (UINT nFlags, CPoint point); // double-click the static control (display video) Response Function
 
. Cpp File
[Cpp]
// Define the message
ON_STN_DBLCLK (IDC_STATIC_VIDEOWND, OnDoubleStatic) ON_STN_DBLCLK (IDC_STATIC_VIDEOWND, OnDoubleStatic)
 
// Obtain the original position in the initialization function in the main window. cpp file.
M_videoWnd.GetWindowRect (& m_Old );
ScreenToClient (& m_Old );
 
In the main window. cpp File
[Cpp]
//
Void CTestVoxCVSA_DemoDlg: OnDoubleStatic (UINT nFlags, CPoint point)
{
CTestVoxCVSA_DemoDlg * m_pDemoDlg = (CTestVoxCVSA_DemoDlg *) AfxGetApp ()-> m_pMainWnd;
If (m_isFullScreen = FALSE)
{
CWnd * saveParent = m_videoWnd.GetParent ();
M_videoWnd.SetParent (getmediatopwindow ());
CRect rect;
GetWindowRect topwindow ()-> GetWindowRect (& rect );
M_videoWnd.SetWindowPos (& wndTopMost, rect. left, rect. top, rect. right, rect. bottom, SWP_SHOWWINDOW );
M_pDemoDlg-> ShowWindow (SW_HIDE );
M_isFullScreen = TRUE;
}
CDialog: OnLButtonDblClk (nFlags, point );
}
 
// Function for obtaining messages
BOOL CTestVoxCVSA_DemoDlg: PreTranslateMessage (MSG * pMsg)
{
CTestVoxCVSA_DemoDlg * m_pDemoDlg = (CTestVoxCVSA_DemoDlg *) AfxGetApp ()-> m_pMainWnd;
If (pMsg-> message = WM_LBUTTONDBLCLK) & (m_isFullScreen = TRUE ))
{
M_pDemoDlg-> ShowWindow (SW_SHOW );
M_videoWnd.SetParent (m_pDemoDlg );
M_videoWnd.SetWindowPos (& wndTop, m_Old.left, m_Old.top, m_Old.right-m_Old.left, m_Old.bottom-m_Old.top, SWP_SHOWWINDOW );
M_isFullScreen = FALSE;
Return TRUE;
}
Return CWnd: PreTranslateMessage (pMsg );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.