revplaythread.cpp
来自「VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"」· C++ 代码 · 共 74 行
CPP
74 行
// RevPlayThread.cpp : implementation file
//
#include "stdafx.h"
#include "winsock2.h"
#include "RevPlayThread.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
HANDLE CRevPlayThread::m_hEventRevPlayThreadKilled;
/////////////////////////////////////////////////////////////////////////////
// CRevPlayThread
IMPLEMENT_DYNCREATE(CRevPlayThread, CWinThread)
CRevPlayThread::CRevPlayThread()
{
}
CRevPlayThread::~CRevPlayThread()
{
}
BOOL CRevPlayThread::InitInstance()
{//创建接收播放窗口
// TODO: perform and per-thread initialization here
CWnd* pParent = CWnd::FromHandle(m_hwndParent);
CRect rect;
CoInitialize(NULL);
pParent->GetClientRect(&rect);
//创建接收播放窗口
BOOL bReturn = m_wndRevPlay.Create(_T("接收播放"),
WS_CHILD | WS_VISIBLE, rect, pParent);
//将m_pMainWnd设置为新创建的CRevPlayWnd窗口
//保证当CRevPlayWnd窗口被删除时,线程被自动删除
if(bReturn)
m_pMainWnd = &m_wndRevPlay;
return bReturn;
}
int CRevPlayThread::ExitInstance()
{
// TODO: perform any per-thread cleanup here
CoUninitialize();
return CWinThread::ExitInstance();
}
BEGIN_MESSAGE_MAP(CRevPlayThread, CWinThread)
//{{AFX_MSG_MAP(CRevPlayThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRevPlayThread message handlers
CRevPlayThread::CRevPlayThread(HWND hwndParent):m_hwndParent(hwndParent)
{
}
void CRevPlayThread::operator delete(void *p)
{
SetEvent(m_hEventRevPlayThreadKilled);
CWinThread::operator delete(p);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?