⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cvideowindow.cpp

📁 陆其明的实务精选中附带光盘中的视频聊天源代码
💻 CPP
字号:
//
// CVideoWindow.cpp
//

/*-----------------------------------------------------*\
			HQ Tech, Make Technology Easy!       
 More information, please go to http://hqtech.nease.net.
/*-----------------------------------------------------*/

#include "stdafx.h"
#include "CVideoWindow.h"
#include "CDXGraph.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
CVideoWindow::CVideoWindow()
{
	mGraph = 0;
}

CVideoWindow::~CVideoWindow()
{
	mGraph = 0;
}

void CVideoWindow::SetGraph(CDXGraph * inGraph)
{
	if (mGraph != inGraph)
	{
		if (mGraph)
		{
			mGraph->SetDisplayWindow(0);
			mGraph->SetNotifyWindow(0);
		}
		mGraph = inGraph;
		if (mGraph)
		{
			mGraph->SetDisplayWindow(m_hWnd);
			mGraph->SetNotifyWindow(m_hWnd);
		}
	}
}

BEGIN_MESSAGE_MAP(CVideoWindow, CWnd)
	//{{AFX_MSG_MAP(CVideoWindow)
	ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CVideoWindow message handlers
LRESULT CVideoWindow::OnGraphNotify(WPARAM inWParam, LPARAM inLParam)
{
	if (mGraph)
	{
		mGraph->HandleEvent(inWParam, inLParam);
	}
	return 0;
}

// Modify the video window style. Furthermore, remember to override
// the Main dialog's WM_ERASEBKGND message procedure, as the following:
/*
BOOL CMainDlg::OnEraseBkgnd(CDC* pDC) // ON_WM_ERASEBKGND()
{
	// Intercept background erasing for the movie window, since the
    // video renderer will keep the screen painted.  Without this code,
    // your video window might get painted over with gray (the default
    // background brush) when it is obscured by another window and redrawn.
    CRect rc;
    // Get the bounding rectangle for the movie screen
    mVideoWnd.GetWindowRect(&rc);
    ScreenToClient(&rc);
    // Exclude the clipping region occupied by our movie screen
    pDC->ExcludeClipRect(&rc);

	// Erase the remainder of the dialog as usual
    return CDialog::OnEraseBkgnd(pDC);
}
*/
void CVideoWindow::PreSubclassWindow(void)
{
	// Since we're embedding video in a child window of a dialog,
    // we must set the WS_CLIPCHILDREN style to prevent the bounding
    // rectangle from drawing over our video frames.
	ModifyStyle(0, WS_CLIPCHILDREN);

	CWnd::PreSubclassWindow();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -