RevPlayThread.cpp
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:2k
源码类别:
VC书籍
开发平台:
Visual C++
- // 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);
- }