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

📄 termthread.cpp

📁 cell phone source code
💻 CPP
字号:
// ApiThread.cpp : implementation file
//

#include "stdafx.h"
#include "AtlasMsg.h"
#include "TermThread.h"


HANDLE CTerminalThread::m_hEventThreadKilled;
HANDLE CTerminalThread::m_hEventThreadCreated;
HANDLE CTerminalThread::m_hEventProtocol;


BOOL bReadSmartMedia;
extern int iUsbBlockSize;

/////////////////////////////////////////////////////////////////////////////
// CTerminalThread

IMPLEMENT_DYNCREATE(CTerminalThread, CWinThread)

CTerminalThread::CTerminalThread()
{
	m_iConnectType = 0;
}

CTerminalThread::~CTerminalThread()
{
}

void CTerminalThread::operator delete(void* p)
{
	// The exiting main application thread waits for this event before completely
	// terminating in order to avoid a false memory leak detection. 

	CWinThread::operator delete(p);
//	OutputDebugString("ApiThread delete this\n");
	SetEvent(m_hEventThreadKilled);
}

void CTerminalThread::PrepareEvent()
{
	m_hEventThreadKilled = CreateEvent(NULL, FALSE, FALSE, NULL); 
	m_hEventThreadCreated = CreateEvent(NULL, FALSE, FALSE, NULL); 
	m_hEventProtocol = CreateEvent(NULL, FALSE, FALSE, NULL); 
}

void CTerminalThread::UnprepareEvent()
{
	CloseHandle(m_hEventThreadKilled);
	CloseHandle(m_hEventThreadCreated);
	CloseHandle(m_hEventProtocol);
}

BOOL CTerminalThread::InitInstance()
{
	// It is important to set CWinThread::m_pMainWnd to the user interface
	// window.  This is required so that when the m_pMainWnd is destroyed,
	// the CWinThread is also automatically destroyed.  For insight into
	// how the CWinThread is automatically destroyed when the m_pMainWnd
	// window is destroyed, see the implementation of CWnd::OnNcDestroy
	// in wincore.cpp of the MFC sources.

//	OutputDebugString("ApiThread begin\n");
	SetEvent(m_hEventThreadCreated);
	return TRUE;
}

int CTerminalThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
//	OutputDebugString("ApiThread end\n");
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CTerminalThread, CWinThread)
	//{{AFX_MSG_MAP(CTerminalThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTerminalThread message handlers
/////////////////////////////////////////////////////////////////////////////
// CTerminalThread public communication functions

⌨️ 快捷键说明

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