📄 serialappdlg.h
字号:
// SerialAppDlg.h : header file
//
#if !defined(AFX_SERAILAPPDLG_H__D2C4A095_AA7C_4E7F_BE14_A11CD5ECE132__INCLUDED_)
#define AFX_SERAILAPPDLG_H__D2C4A095_AA7C_4E7F_BE14_A11CD5ECE132__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Resource.h"
#include "SerialPort.h"
#include "ConfigDlg.h"
#include <io.h>
#include <memory.h>
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#define PI 3.1416
#define WIDTH (480*5)
#define WM_MSG_READ WM_USER+20
//定义同步字节
const BYTE ACK[1]={0xfe};
const BYTE COMMAND[3]={0x33,0x34,0xff};
const WORD nPackSize=0x1000;
const int nSendBuffer=nPackSize*10;
const DWORD TIMELIMIT=3000; // 0.01 Second
const DWORD MAXTIME=300000;
const DWORD SYNTIME=300000; //for send SYN
const DWORD RSDTIME=30000; //for resend
/////////////////////////////////////////////////////////////////////////////
// CSerailAppDlg dialog
class CSerialAppDlg : public CDialog //xxxxxxxx
{
// Construction
public:
CSerialAppDlg(CWnd* pParent = NULL); // standard constructor
~CSerialAppDlg();
// Dialog Data
//{{AFX_DATA(CSerailAppDlg)
enum { IDD = IDD_SERIALAPP_DIALOG };
CProgressCtrl m_ProgressCtrl;
int m_x;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSerailAppDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
unsigned char *pfbuf;
BOOL SendFile();
BOOL ReceiveFile();
void WriteMsg(CString str);
int WriteCommBlock(unsigned char* pBlock, int nLength);
int ReadCommBlock(unsigned char* pBlock, int nMaxLength);
HICON m_hIcon;
CToolBar m_wndToolBar;
CSerialPortEx m_Port; //类对象
CString m_strReceived; //存储由串口接收到的数据
// Attributes
public:
void Calculate();
static UINT SendThread(LPVOID pParam);
static UINT ReceiveThread(LPVOID pParam);
int m_nComm;
int m_nBandRate;
char m_cParity;
int m_nDataBits;
int m_nStopBits;
int m_nSendBuffer;
int lishan_q; //全局变量
DWORD m_dwCommEvents; //为串口参数添加成员
// Generated message map functions
//{{AFX_MSG(CSerailAppDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SERAILAPPDLG_H__D2C4A095_AA7C_4E7F_BE14_A11CD5ECE132__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -