www.pudn.com > 串口以太网通信技术转换.rar > Comm.h
// Comm.h: interface for the Comm class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_COMM_H__17961BD5_A023_11D4_BF22_0000E8E4C832__INCLUDED_)
#define AFX_COMM_H__17961BD5_A023_11D4_BF22_0000E8E4C832__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
typedef struct _CommSet
{
HANDLE hComm;
bool Connected;
HWND m_hWindow;
DWORD ThreadID;
char smode;
} CommSet,*LPCommSet;
class Comm
{
//Attributes
public:
HANDLE comv;
char ComName[5]; // the communication name
//Operation
public:
int speed;
Comm(CWnd *p);
virtual ~Comm();
BOOL initcomport(); // initial the serial port
BOOL SendString(char *p,int length); // send the string directly
LPBYTE GetCommMSRShadow();
private:
//For CommWatchProc thread
CommSet commset;
CWinThread* hCommWatchThread;
HANDLE hCommThread;
OVERLAPPED ComOverlapped;
friend UINT CommWatchProc(LPVOID pParam1);
};
#endif // !defined(AFX_COMM_H__17961BD5_A023_11D4_BF22_0000E8E4C832__INCLUDED_)