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

📄 spythread.cpp

📁 一个手机通信的源代码 一个手机通信的源代码一个手机通信的源代码
💻 CPP
字号:
// SpyThread.cpp: implementation of the CSpyThread class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Province.h"
#include "SpyThread.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSpyThread::CSpyThread(CString SpyQueuePath)
{
::CoInitializeEx(
		NULL,				//always NULL
		COINIT_APARTMENTTHREADED	//see book about threading models
		);
 m_QueuePtr=NULL;
 m_QueueInfoPtr=NULL;
 m_MessagePtr=NULL;
 m_SpyQueuePath=SpyQueuePath;
}

CSpyThread::~CSpyThread()
{

}

void CSpyThread::InitChildClass()
{
 InitQueue();
}

void CSpyThread::ExitThread()
{

}

void CSpyThread::OnTimer(UINT EventID)
{

}

void CSpyThread::SingleStep()
{
 try
 {
	VARIANT TimeOut;
	TimeOut.vt=VT_I4;
	TimeOut.lVal=1;
	m_MessagePtr=m_QueuePtr->Receive(&vtMissing,&vtMissing,&vtMissing,&TimeOut);
	if (m_MessagePtr==NULL)
		 return;
 }
 catch(_com_error& e)
 {
   CMsmqerr errtemp;
   CString ErrorInfo;
   ErrorInfo.Format("Read queue error:%s",errtemp.GetErrText(e));
   ReportError(ErrorInfo);
 }
}

void CSpyThread::ReportError(CString &csErrorInfo)
{

}

BOOL CSpyThread::InitQueue()
{
::CoInitializeEx(
		NULL,				//always NULL
		COINIT_APARTMENTTHREADED	//see book about threading models
		);
 try{
   m_QueueInfoPtr.CreateInstance(__uuidof(MSMQQueueInfo));
   m_QueueInfoPtr->PutFormatName(_bstr_t(m_SpyQueuePath));
   m_QueuePtr=m_QueueInfoPtr->Open(MQ_RECEIVE_ACCESS,MQ_DENY_NONE);
 }
 catch(_com_error& e)
 {
   CMsmqerr errtemp;
   CString ErrorInfo;
   ErrorInfo.Format("Init spy queue error:%s",errtemp.GetErrText(e));
   ReportError(ErrorInfo);
   return FALSE;
 }
 return TRUE;
}

⌨️ 快捷键说明

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