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

📄 serialportdlg.h

📁 这是在windowce环境下用evc编写的MagicARM平台上的一个与RS485通讯的程序
💻 H
字号:
// SerialPortDlg.h : header file
//

#if !defined(AFX_SERIALPORTDLG_H__06EEB5B3_71D3_4CD5_8216_04F9C9FDE3D1__INCLUDED_)
#define AFX_SERIALPORTDLG_H__06EEB5B3_71D3_4CD5_8216_04F9C9FDE3D1__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

/////////////////////////////////////////////////////////////////////////////
// CSerialPortDlg dialog

class CSerialPortDlg : public CDialog
{
// Construction
public:
	CSerialPortDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CSerialPortDlg)
	enum { IDD = IDD_SERIALPORT_DIALOG };
	CButton	m_ButClose;
	CButton	m_ButOpen;
	CComboBox	m_ComboStop;
	CComboBox	m_ComboParity;
	CComboBox	m_ComboPort;
	CComboBox	m_ComboData;
	CComboBox	m_ComboBaud;
	CString	m_strSendEdit;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSerialPortDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;
	HANDLE m_hFileGpio;

	// Generated message map functions
	//{{AFX_MSG(CSerialPortDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnOpenCom();
	afx_msg void OnCloseCom();
	afx_msg void OnSend();
	afx_msg void OnClearSend();
	afx_msg void OnClearRec();
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

	
	DCB dcb;						/* 串口参数结构体 */
	HANDLE m_hComm;					/* 串口操作句柄 */
	HANDLE m_ExitThreadEvent;		/* 串口接收线程退出事件 */
	CString m_strRecDisp;			/* 接收区显示字符 */
	
	BOOL ClosePort(void);			/* 关闭串口 */

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

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

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

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SERIALPORTDLG_H__06EEB5B3_71D3_4CD5_8216_04F9C9FDE3D1__INCLUDED_)

⌨️ 快捷键说明

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