netcomthread.cpp

来自「用算法来实现一个收费系统」· C++ 代码 · 共 85 行

CPP
85
字号
// NetComThread.cpp : implementation file
//

#include "stdafx.h"
#include "LaneSoft.h"
#include "MainFrm.h"
#include "NetComThread.h"
#include "NetComManger.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNetComThread

IMPLEMENT_DYNCREATE(CNetComThread, CWinThread)

CNetComThread::CNetComThread()
{
	m_pNetCom = new CNetComManger;
}

CNetComThread::~CNetComThread()
{
	delete m_pNetCom;
}

BOOL CNetComThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here

	return TRUE;
}

int CNetComThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here

	return CWinThread::ExitInstance();
}
LONG CNetComThread::OnTimerClock(UINT wParam,LONG lParam)
{
	m_pNetCom->SecondDuty();

	//	m_pNetCom->TxjSecondDuty() ;
	return 0;
}
LONG CNetComThread::OnTimerTxjClock(UINT wParam,LONG lParam)
{
//	m_pNetCom->SecondDuty();
	m_pNetCom->TxjSecondDuty() ;
	return 0;
}



LONG CNetComThread::OnKey(UINT wParam,LONG lParam)
{
	m_pData_Use = (Data_Use *) lParam;
	m_pNetCom->netSendMsg((Data_Use *)m_pData_Use,sizeof(Data_Use));
	return 0;
}
LONG CNetComThread::OnKeyTxj(UINT wParam,LONG lParam)
{
	m_pData_Use = (Data_Use *) lParam;
	m_pNetCom->TxjnetSendMsg((Data_Use *)m_pData_Use,sizeof(Data_Use));
//	m_pNetCom->TxjnetSendMsg();
	return 0;
}

BEGIN_MESSAGE_MAP(CNetComThread, CWinThread)
	//{{AFX_MSG_MAP(CNetComThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		ON_THREAD_MESSAGE(WM_TIME_COLOCK,OnTimerClock)
		ON_THREAD_MESSAGE(WM_KEY_USE,OnKey)
		ON_THREAD_MESSAGE(WM_TIMETXJ_COLOCK,OnTimerTxjClock)
		ON_THREAD_MESSAGE(WM_KEYTXJ_USE,OnKeyTxj)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNetComThread message handlers

⌨️ 快捷键说明

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