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

📄 chuankoudlg.h

📁 基于wince下串口助手源代码。可以支持十六进制发送接收。
💻 H
字号:
// ChuankouDlg.h : header file
//

#if !defined(AFX_CHUANKOUDLG_H__DAB1BD85_7CE5_48B5_823F_0CE231B8366C__INCLUDED_)
#define AFX_CHUANKOUDLG_H__DAB1BD85_7CE5_48B5_823F_0CE231B8366C__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "CESeries.h"
/////////////////////////////////////////////////////////////////////////////
// CChuankouDlg dialog

class CChuankouDlg : public CDialog
{
// Construction
public:
	void OpenThind(CWnd* pPortOwner);
//	DWORD Progress(LPVOID lparam);
	char ConvertHexChar(TCHAR ch);
	int String2Hex(CString str, CByteArray &senddata);
//	void ReadPort();
	CChuankouDlg(CWnd* pParent = NULL);	// standard constructor
	//打开串口
	BOOL OpenPort(CWnd* pPortOwner,			/*使用串口类,窗体句柄*/
				  UINT portNo	= 1,		/*串口号*/
				  UINT baud		= 9600,	/*波特率*/
				  UINT parity	= NOPARITY, /*奇偶校验*/
				  UINT databits	= 8,		/*数据位*/
				  UINT stopbits	= 0        /*停止位*/
				  );
	void ClosePort();
	BOOL WritePort(HANDLE hComm,const BYTE *buf,DWORD bufLen);
// Dialog Data
	//{{AFX_DATA(CChuankouDlg)
	enum { IDD = IDD_CHUANKOU_DIALOG };
	BOOL	m_16;
	BOOL	m_dis;
	BOOL	m_Cortrol;
	CString	m_strRecv;
	//}}AFX_DATA
	HANDLE	m_hComm;
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CChuankouDlg)

protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL
	
// Implementation
public:
	HANDLE m_hReadThread;
	DWORD m_dwReadThreadID;
	HANDLE m_hReadCloseEvent;
	CWnd* m_pPortOwner;
	UINT bufLen;
	UINT m_len;
	UINT con;
	CRect m_rect;
	CString m_strSend;
//	CCESeries m_ceSeries; //定义串口类
private:
//	static void OnSeriesRead(CWnd* pWnd,BYTE* buf,int bufLen);
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CChuankouDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnButtonExit();
	afx_msg void OnButtonReset();
	afx_msg void OnButtonSend();
	afx_msg void OnButtonClose();
	afx_msg void OnButtonOpen();
	afx_msg void OnCheck1();
	afx_msg void OnSetfocusEdit2();
	afx_msg void OnKillfocusEdit2();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnButton5();
	afx_msg void OnButton6();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
//private:
//	CCESeries m_ceSeries; //定义串口类
public:
	static void OnSeriesRead(CWnd* pWnd,BYTE* buf,int bufLen);
private:
	//关闭读线程
	void CloseReadThread();
    //串口读线程函数
     static  DWORD WINAPI ReadThreadFunc(LPVOID lparam);

};

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

#endif // !defined(AFX_CHUANKOUDLG_H__DAB1BD85_7CE5_48B5_823F_0CE231B8366C__INCLUDED_)

⌨️ 快捷键说明

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