📄 stdafx.h
字号:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__21ADAB8E_587D_4006_ACED_3BE672CF5F68__INCLUDED_)
#define AFX_STDAFX_H__21ADAB8E_587D_4006_ACED_3BE672CF5F68__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//-------------------------------------------------------------------------
// HH 2006-2-6 define (zhengzhou jiangda Electronics )
#include "NewCrc.h"
#define TITLE "ModBus Debug Tool [韩工 2006-02-05 Make]"
#define ZERO 0
#define ONE 1
#define TWO 2
#define THREE 3
#define FOUR 4
#define FIVE 5
#define SIX 6
#define SEVEN 7
#define EIGHT 8
#define NINE 9
#define TEN 10
typedef struct COMAPIVALUE
{
BYTE bWS[FOUR];
long lngWS;
BYTE bYYHT[FOUR];
long lngYYHT;
BYTE bEYHT[FOUR];
long lngEYHT;
BYTE bWD[FOUR];
long lngWD;
BYTE bDYDY[FOUR];
long lngDYDY;
BYTE bBY[FOUR];
long lngBY;
int intAddr;
int intLastError;
int commandIndex;
int zjIndex;
}CHVALUE,FAR *LPCHVALUE;
typedef struct COMPARAM
{
BYTE bPort;
DWORD dwBuad;
BYTE bStepBit;
BYTE bDataBit;
char cParity;
char szBuad[50];
}SETCOMPARAM;
typedef struct APICOMTHREAD
{
HANDLE m_hCom;
HWND m_This;
OVERLAPPED m_Rdos;
OVERLAPPED m_Wdos;
COMMTIMEOUTS m_Commtimeouts;
CRITICAL_SECTION m_Lock;
SETCOMPARAM cParam;
CHVALUE lpCHValue;
int iTermIndex;
BOOL blWhile;
}COMTHREAD,FAR *LPCOMTHREAD;
inline unsigned short Get_CRC_Value(BYTE *crcbyte,int iLen)
{
CNewCrc objNewCrc;
BYTE bt[100];
for (int i=0;i<iLen;i++)
bt[i]=*(crcbyte++);
return objNewCrc.ModBus_CRC(bt,iLen);
}
inline void Make_Info(BYTE *nbyte,CString strHL)
{
int iH,iL,sumHL,strLen[TWO];
CString strTemp;
char cTemp[50];
iH=iL=sumHL=strLen[ZERO]=strLen[ONE]=ZERO;
if(strHL=="")
return;
strLen[ZERO]=strHL.GetLength();
strTemp=strHL.Left(strLen[ZERO]-FOUR);
strLen[ONE]=strTemp.GetLength();
for(int u=ZERO;u<strLen[ONE];u++)
cTemp[u]=strTemp.GetAt(u);
for(int j=ZERO;j<strLen[ONE];j+=TWO)
{
iH=cTemp[j];
iH=iH>0x39?iH-0x37:iH-0x30;
iL=cTemp[j+ONE];
iL=iL>0x39?iL-0x37:iL-0x30;
sumHL=iH*16+iL;
*nbyte++=sumHL;
}
}
BYTE inline Check_InputData( CString pszdata )
{
if ( pszdata == "" )
return 4; //unInit
int len = pszdata.GetLength();
if ( len > 6 )
return 3; //max lenght
for ( int n=0; n<len; n++ )
{
if ( pszdata.GetAt(n) < 0x30 || pszdata.GetAt(n) > 0x39 )
return 2;
}
return 1;
}
//-------------------------------------------------------------------------
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__21ADAB8E_587D_4006_ACED_3BE672CF5F68__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -