📄 dk20dieselizedynamotor.cpp
字号:
// DK20DieselizeDynamotor.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "DK20DieselizeDynamotor.h"
#include "DK20DieselizeDynamotorDlg.h"
#include "DlgLanguage.h"
#include "WraningControl.h"
#include "Led.h"
#include "Meter.h"
#include "PSerialPort.h"
#include "afxdb.h"
#include "RecordWarning.h"
#include "Thermometer.h"
#include "DialogID.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDK20DieselizeDynamotorApp
BEGIN_MESSAGE_MAP(CDK20DieselizeDynamotorApp, CWinApp)
//{{AFX_MSG_MAP(CDK20DieselizeDynamotorApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDK20DieselizeDynamotorApp construction
CDK20DieselizeDynamotorApp::CDK20DieselizeDynamotorApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDK20DieselizeDynamotorApp object
CDK20DieselizeDynamotorDlg * mainDlg;
CDK20DieselizeDynamotorApp theApp;
BOOL bChinese;
CWraningControl m_Warningcontrol[12];
BOOL bPass;
//3个关键停车led灯
CLed m_led[9];
//3个关键量表
CMeter m_meter[6];
CThermometer m_thermoneter[3];
//15个虚拟模块
VIRTUALMOUDLE moudle[15] ;
//虚拟模块的临时变量
MOUDLE_VALUE mTmp ;
//3个串口的返回数据
CString strData1;
CString strData2;
CString strData3;
CString strIDN1;
CString strIDN2;
CString strIDN3 ;
CTime tBeginTime;
//3个串口的发送数据
BYTE byteArray1[20] ;
BYTE byteArray2[20] ;
BYTE byteArray3[20] ;
byte bPortStatus1[16];
byte bPortStatus2[16];
byte bPortStatus3[16];
//报警信息线程
CWinThread *m_thread;
THREAD_INFO thread_info ;
BOOL m_bKillThread;
//串口1线程
CWinThread *m_thread1;
THREAD_INFO thread_info1 ;
BOOL m_bKillThread1;
//串口2线程
CWinThread *m_thread2;
THREAD_INFO thread_info2 ;
BOOL m_bKillThread2;
//串口3线程
CWinThread *m_thread3;
THREAD_INFO thread_info3 ;
BOOL m_bKillThread3;
//3个串口指针
CPSerialPort * m_pSerial1;
CPSerialPort * m_pSerial2;
CPSerialPort * m_pSerial3;
//4个线程函数
UINT ProcLoop1(LPVOID lp);
//3个串口命令
UINT SendComdata1(LPVOID lp) ;
UINT SendComdata2(LPVOID lp) ;
UINT SendComdata3(LPVOID lp) ;
//报警信息线程函数
UINT AddWarningString(LPVOID lp);
//数据库
CDatabase m_db;
bool bOpen;
//报警控件状态
int controlStatusstauts[15][16] ;
int controlStatus[6][18];
//环境温度
float fTEMP1 ;
float fTEMP2 ;
float fTEMP3 ;
/////////////////////////////////////////////////////////////////////////////
// CDK20DieselizeDynamotorApp initialization
BOOL CDK20DieselizeDynamotorApp::InitInstance()
{
//先启动语言选择窗口
CDlgLanguage dlgLanguage;
int iResult=dlgLanguage.DoModal();
if (iResult!=IDOK)
{
exit(1);
}
CDialogID dlgIDN ;
int iid = dlgIDN.DoModal();
if (iid!=IDOK)
{
exit(1);
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
m_pSerial1 = new CPSerialPort();
m_pSerial2 = new CPSerialPort();
m_pSerial3 = new CPSerialPort();
CDK20DieselizeDynamotorDlg dlg;
m_pMainWnd = &dlg;
mainDlg =&dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
delete m_pSerial1;
m_pSerial1=NULL;
delete m_pSerial2;
m_pSerial2=NULL;
delete m_pSerial3;
m_pSerial3=NULL;
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -