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 );
}