monitordoc.h

来自「模拟了tec2000的所有功能」· C头文件 代码 · 共 94 行

H
94
字号
// MonitorDoc.h : interface of the CMonitorDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MONITORDOC_H__3582D245_A3D2_49E4_8484_2F09EF881096__INCLUDED_)
#define AFX_MONITORDOC_H__3582D245_A3D2_49E4_8484_2F09EF881096__INCLUDED_

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

#define MAXBLOCK 4096
#include"SetupDlg.h"
#include"SetAddrDlg.h"

UINT CommThread(LPVOID pParam);
class CMonitorDoc : public CDocument
{
protected: // create from serialization only
	CMonitorDoc();            //构造函数
	DECLARE_DYNCREATE(CMonitorDoc)

// Attributes
public:
	CWinThread *m_pThread;            //辅助监控线程
	volatile BOOL m_bConnected;       //标志串口是否连接上
	OVERLAPPED m_ovRead,m_ovWrite;    //用于读/写串口的OVERLAPPED结构体   
	volatile HANDLE m_hComm;          //串口句柄
	volatile HANDLE m_hPostMsgEvent;  //用于WM_COMMNOTIFY消息的事件句柄
	volatile HWND   m_hTermWnd;       //窗口指针
	int m_nBaud;
	int m_nDataBits;
	int m_nParity;
	CString m_sPort;
	int m_nStopBits; 


// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMonitorDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
  	virtual BOOL CanCloseFrame(CFrameWnd *pFrame);
	//}}AFX_VIRTUAL

// Implementation
public:
	char * FillZero(char *str);  //将字符串补足四位,如23->0023
	virtual ~CMonitorDoc();     //析构函数
 	void WaitDataArrival();    //等待输入缓冲区接收到新字符
    BOOL ConfigConnection();   //配置串口DCB结构体
	void CloseConnection();  //关闭串口
	BOOL OpenConnection();   //打开串口,并启动辅助监控线程
    DWORD ReadPort(char *buff,DWORD dwLength);  //读串口
	DWORD WritePort(char *buff,DWORD dwLength); //写串口

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;

	
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CMonitorDoc)
 	afx_msg void OnConnect();
	afx_msg void OnUpdateConnect(CCmdUI* pCmdUI);
 	afx_msg void OnDisconnect();
	afx_msg void OnUpdateDisconnect(CCmdUI* pCmdUI);
	afx_msg void OnFileExport();
	afx_msg void OnUpdateFileExport(CCmdUI* pCmdUI);
	afx_msg void OnFileImport();
	afx_msg void OnUpdateFileImport(CCmdUI* pCmdUI);
	afx_msg void OnSettings();
	afx_msg void OnUpdateSettings(CCmdUI* pCmdUI);
	//}}AFX_MSG
	  DECLARE_MESSAGE_MAP()

};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_MONITORDOC_H__3582D245_A3D2_49E4_8484_2F09EF881096__INCLUDED_)

⌨️ 快捷键说明

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