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

📄 mscomm.h

📁 这是串口通信软件的vc代码,主要用于与单片机进行通信,方便对单片机的学习
💻 H
字号:
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++

// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.

/////////////////////////////////////////////////////////////////////////////
// CMSComm wrapper class

class CMSComm : public CWnd
{
protected:
	DECLARE_DYNCREATE(CMSComm)
public:
	CLSID const& GetClsid()
	{
		static CLSID const clsid
			= { 0x648a5600, 0x2c6e, 0x101b, { 0x82, 0xb6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14 } };
		return clsid;
	}
	virtual BOOL Create(LPCTSTR lpszClassName,
		LPCTSTR lpszWindowName, DWORD dwStyle,
		const RECT& rect,
		CWnd* pParentWnd, UINT nID,
		CCreateContext* pContext = NULL)
	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
		const RECT& rect, CWnd* pParentWnd, UINT nID,
		CFile* pPersist = NULL, BOOL bStorage = FALSE,
		BSTR bstrLicKey = NULL)
	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
		pPersist, bStorage, bstrLicKey); }

// Attributes
public:

// Operations
public:
	void SetCDHolding(BOOL bNewValue);
	BOOL GetCDHolding();
	void SetCommID(long nNewValue);
	long GetCommID();
	void SetCommPort(short nNewValue);////设置端口号,如nNewValue =1表示COM1
	short GetCommPort();
	void SetCTSHolding(BOOL bNewValue);
	BOOL GetCTSHolding();
	void SetDSRHolding(BOOL bNewValue);
	BOOL GetDSRHolding();
	void SetDTREnable(BOOL bNewValue);
	BOOL GetDTREnable();
	void SetHandshaking(long nNewValue);
	long GetHandshaking();
	void SetInBufferSize(short nNewValue);
	short GetInBufferSize();
	void SetInBufferCount(short nNewValue);
	short GetInBufferCount();
	void SetBreak(BOOL bNewValue);
	BOOL GetBreak();
	void SetInputLen(short nNewValue);
	short GetInputLen();
	void SetNullDiscard(BOOL bNewValue);
	BOOL GetNullDiscard();
	void SetOutBufferSize(short nNewValue);
	short GetOutBufferSize();
	void SetOutBufferCount(short nNewValue);
	short GetOutBufferCount();
	void SetParityReplace(LPCTSTR lpszNewValue);
	CString GetParityReplace();
	void SetPortOpen(BOOL bNewValue);	////打开或关闭串口,TRUE:打开,FALSE:关闭

	BOOL GetPortOpen();		////串口是否已打开,TRUE:打开,FALSE:关闭

	void SetRThreshold(short nNewValue);//如果设置为1,表示一接收到字符就发送2号事件

	short GetRThreshold();
	void SetRTSEnable(BOOL bNewValue);////硬件握手使能?

	BOOL GetRTSEnable();
	void SetSettings(LPCTSTR lpszNewValue);	////Settings由4部分组成,
	////其格式为:"BBBB,P,D,S",即"波特率,是否奇偶校验,数据位 //个数,停止位",
	////如设置为:"9600,n,8,1"

	CString GetSettings();
	void SetSThreshold(short nNewValue);////如果保持缺省值0不变,则表示发送数据的过程中串口上不发生事件

	short GetSThreshold();
	void SetOutput(const VARIANT& newValue);////一个非常重要的函数,用于写串口,
	////注意其接收的输入参数为VARIANT类型对象, 
	////我们需要将字符串转化为VARIANT类型对象

	VARIANT GetOutput();
	void SetInput(const VARIANT& newValue);//////一个非常重要的函数,用于读串口,
	////注意其返回的是VARIANT类型对象,我们需要将其转化为字符串

	VARIANT GetInput();
	void SetCommEvent(short nNewValue);
	short GetCommEvent();////一个非常重要的函数,获得串口上刚发生的事件
	////("事件"可以理解为软件意义上的"消息"或硬件意义上的"中断"),
	////事件的发送会导致OnComm消息的诞生!

	void SetEOFEnable(BOOL bNewValue);
	BOOL GetEOFEnable();
	void SetInputMode(long nNewValue);
	long GetInputMode();
};

⌨️ 快捷键说明

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