www.pudn.com > gps-time.rar > ComThrd.cpp


// ComThrd.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "RegionComm.h" 
#include "ComThrd.h" 
#include "Communication.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CComThrd 
 
IMPLEMENT_DYNCREATE(CComThrd, CWinThread) 
 
CComThrd::CComThrd() 
{ 
	m_pOwner=NULL; 
} 
 
CComThrd::~CComThrd() 
{ 
} 
 
BOOL CComThrd::InitInstance() 
{	 
	return TRUE; 
} 
 
int CComThrd::ExitInstance() 
{ 
	return CWinThread::ExitInstance(); 
} 
 
BEGIN_MESSAGE_MAP(CComThrd, CWinThread) 
	//{{AFX_MSG_MAP(CComThrd) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CComThrd message handlers 
 
int CComThrd::Run()  
{ 
    if(m_pOwner==NULL) 
		return(0); 
    m_pOwner->TryToReadAllComm(); 
	return(1); 
} 
 
void CComThrd::SetOwner(CCommunication* pOwner) 
{ 
	m_pOwner = pOwner; 
}