// MultiTerminal2.h: MultiTerminal2 应用程序的主头文件 // #pragma once #ifndef __AFXWIN_H__ #error "include 'pch.h' before including this file for PCH" #endif #include "resource.h" // 主符号 #include "../mylib/LOGGER/Logger.hpp" #include "../MyLib/MHashINI/MHash.hpp" #include "KDefine.h" //#include "KLink.h" #include "KMachine.h" #include "../KLink1/KLink.h" #pragma comment(lib,"KLink1.lib") void Trans_Tunc(unsigned int, EXCEPTION_POINTERS*); #define CHECKE(func) try {func;} catch(SE_Exception &e) {DisplayException(_T(__FILE__),__LINE__,_T(__FUNCTION__),_T(#func),e);} catch (CException * e) {DisplayException(_T(__FILE__),__LINE__,_T(__FUNCTION__),_T(#func),e);} catch (...){DisplayException(_T(__FILE__),__LINE__,_T(__FUNCTION__),_T(#func));} class SE_Exception { private: SE_Exception() {} unsigned int nSE; PVOID Addr; CString InfoStr; public: SE_Exception(SE_Exception& e) : nSE(e.nSE) {} SE_Exception(unsigned int n) :nSE(n) {} SE_Exception(unsigned int n, PVOID a) :nSE(n), Addr(a) {} SE_Exception(unsigned int n, PVOID a, CString &str1) :nSE(n), Addr(a), InfoStr(str1) {} ~SE_Exception() {} unsigned int getSeNumber() { return nSE; } PVOID getAddress() { return Addr; } CString & getInfoStr() { return InfoStr; } }; int DisplayException(CString File, int Line, CString Func, CString Sentence, SE_Exception &e); int DisplayException(CString File, int Line, CString Func, CString Sentence, CException *e); int DisplayException(CString File, int Line, CString Func, CString Sentence); int SaveMyConfig(); int LoadMyConfig(); int SysLog(CString s, int channel = 0); int DbgLog(CString s, int channel = 0); int PopupMessage(CString s, int channel = 0); void DoEvents(); extern MHash MyCfg1; extern Logger myLogger1; // CMTerm1App: // 有关此类的实现,请参阅 MultiTerminal2.cpp // class CMTerm1App : public CWinAppEx { public: CMTerm1App() noexcept; CMultiDocTemplate* pDocTemplate; CMultiDocTemplate * m_pLdsViewTemplate; CMultiDocTemplate * m_pBldViewTemplate; CMultiDocTemplate * m_pBnlViewTemplate; CMultiDocTemplate * m_pCtrlViewTemplate; CMultiDocTemplate * m_pProgViewTemplate; CMultiDocTemplate * m_pCoilViewTemplate; CMultiDocTemplate * m_pDataViewTemplate; CMultiDocTemplate * m_pCommDevViewTemplate; CMultiDocTemplate * m_pNewDocTemplate; // 重写 public: virtual BOOL InitInstance(); virtual int ExitInstance(); // 实现 bool m_bHiColorIcons; KMachine myKMachine1; KLink1 MyKLink1; union { unsigned char KBDD[2048]; unsigned short KBDT[1024]; unsigned char KBDB[2048]; }; union { unsigned char KWLD[2048]; unsigned short KWLT[1024]; unsigned char KWLB[2048]; }; bool m_bCommParamSet = false; int nComPort; int nBaud; CStringA ComSettings; bool m_bOnline = false; bool m_bSimulate = false; bool m_bPlcRunning = false; afx_msg void OnAppAbout(); DECLARE_MESSAGE_MAP() afx_msg void OnFileNew(); afx_msg void OnComunicationSet(); afx_msg void OnEnvSet(); }; extern CMTerm1App theApp; //class CAnsiParser; //class CDataParser1; //class KLink; //class CSerialCom; //class HvSerialPort; //extern CAnsiParser MyAnsiParser1; //extern CDataParser1 MyDataParser1; //extern KLink MyKLink1; // extern CSerialCom MySerialCom1; //extern HvSerialPort myHvSerialPort1; CString intToString(int num,int digit=0); CString fixToString(int num, int digit = 0, int fracdigit = 0); CString & intToBinString(int num, int digits = 8); int get_com_name(CString comx, CString &namebuf); CString DeviceTypeToStr(int DeviceTypeVer);