📄 comport.h
字号:
// ComPort.h: interface for the CComPort class.
// 串口操作类
// 芯艺 (c) copyright 2004
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_COMPORT_H__080871CC_1C4D_48AA_AC87_662E9ADBE054__INCLUDED_)
#define AFX_COMPORT_H__080871CC_1C4D_48AA_AC87_662E9ADBE054__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CComPort
{
public:
void ClearBuffer(); //清串行口缓冲区
void GetError(CString &str);
CString m_strLastError; //最近发生的错误描述
UINT Read(UCHAR *buf,UINT len,DWORD timeout);
UINT Write(UCHAR *buf,UINT len);
OVERLAPPED m_ovRead, m_ovWrite; // 用于重叠读/写
void Close();
HANDLE m_hCom; //串口打开句柄
BOOL Open(int portnum);
int m_nCurrentCom; //当前打开的串口
CComPort();
virtual ~CComPort();
};
#endif // !defined(AFX_COMPORT_H__080871CC_1C4D_48AA_AC87_662E9ADBE054__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -