workerthread.cpp

来自「VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一」· C++ 代码 · 共 64 行

CPP
64
字号
// WorkerThread.cpp : implementation file
//

#include "stdafx.h"
#include "cwinthread.h"
#include "WorkerThread.h"

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

/////////////////////////////////////////////////////////////////////////////
// WorkerThread

IMPLEMENT_DYNCREATE(WorkerThread, CWinThread)

WorkerThread::WorkerThread()
{
}

WorkerThread::~WorkerThread()
{
}

BOOL WorkerThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int WorkerThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

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

/////////////////////////////////////////////////////////////////////////////
// WorkerThread message handlers

int WorkerThread::Run()
{
  MSG msg;
  while (::GetMessage(&msg, NULL, 0, 0))
  {
    switch(msg.message)
    {
    case MYMESSAGE:
      TRACE(":Message Received\n");
      break;
    default:
      break;
    }
  }
  return 0;
}

⌨️ 快捷键说明

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