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

📄 serialdlg.h

📁 Wince 串口例程 Wince 串口例程 Wince 串口例程
💻 H
字号:
// SerialDlg.h : 头文件
//

#pragma once

// CSerialDlg 对话框
class CSerialDlg : public CDialog
{
// 构造
public:
	CSerialDlg(CWnd* pParent = NULL);	// 标准构造函数

// 对话框数据
	enum { IDD = IDD_SERIAL_DIALOG };
	CButton	ButClose;
	CButton	ButOpen;
	CButton	ButSend;
    CString	strSendEdit;


	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持

// 实现
protected:
	HICON m_hIcon;

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
	afx_msg void OnOpenCom();
	afx_msg void OnCloseCom();
	afx_msg void OnSend();
	afx_msg void OnDestroy();
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
	afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/);
#endif
	DECLARE_MESSAGE_MAP()
	DCB dcb;						/* 串口参数结构体 */
	HANDLE hComm;					/* 串口操作句柄 */
	HANDLE ExitThreadEvent;		/* 串口接收线程退出事件 */
	CString strRecDisp;			/* 接收区显示字符 */
	BOOL ClosePort(void);			/* 关闭串口 */

	// 打开串口 
	BOOL OpenPort(LPCTSTR Port, int BaudRate, int DataBits, int StopBits, int Parity);

	// 串口接收线程
	static DWORD ComRecvThread(LPVOID lparam);

	// 串口接收数据成功回调函数
	typedef void (CALLBACK *ONCOMMRECV)(CWnd* pWnd, char *buf, int buflen);
	static void CALLBACK OnComRecv(CWnd* pWnd, char *buf, int buflen);
};

⌨️ 快捷键说明

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