| | |
| | | #include "Servo.h" |
| | | #include "ServoDlg.h" |
| | | #include "ServoGraph.h" |
| | | #include "AlarmManager.h" |
| | | #include "SECSRuntimeManager.h" |
| | | #include "ProductionLogManager.h" |
| | | #include "VerticalLine.h" |
| | | #include "EqsGraphWnd.h" |
| | | #include "MapPosWnd.h" |
| | | #include "HmTab.h" |
| | | |
| | | |
| | | // 声明全局变量,用于管理 GDI+ 初始化 |
| | | ULONG_PTR g_diplusToken; |
| | |
| | | |
| | | BOOL CServoApp::InitInstance() |
| | | { |
| | | // 如果一个运行在 Windows XP 上的应用程序清单指定要 |
| | | // TODO: 调用 AfxInitRichEdit2() 以初始化 richedit2 库。\n" // 如果一个运行在 Windows XP 上的应用程序清单指定要 |
| | | // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, |
| | | //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 |
| | | INITCOMMONCONTROLSEX InitCtrls; |
| | |
| | | |
| | | // 注册控件 |
| | | CServoGraph::RegisterWndClass(); |
| | | CVerticalLine::RegisterWndClass(); |
| | | CEqsGraphWnd::RegisterWndClass(); |
| | | CMapPosWnd::RegisterWndClass(); |
| | | CHmTab::RegisterWndClass(); |
| | | |
| | | |
| | | // 初始化Rx库 |
| | |
| | | |
| | | // 初始化 GDI+ |
| | | InitGDIPlus(); |
| | | |
| | | |
| | | // 初始化 MFC RichEdit 控件 |
| | | AfxInitRichEdit2(); |
| | | |
| | | |
| | | // 初始化报警管理器 |
| | | try { |
| | | if (!AlarmManager::getInstance().initAlarmTable()) { |
| | | AfxMessageBox("初始化报警管理器失败!"); |
| | | return FALSE; |
| | | } |
| | | } |
| | | catch (const std::exception& ex) { |
| | | CString errorMsg; |
| | | errorMsg.Format(_T("初始化报警管理器失败:%s"), CString(ex.what())); |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | | AlarmManager::getInstance().insertMockData(); |
| | | |
| | | |
| | | // 初始化生产履历管理器 |
| | | //try { |
| | | // if (!ProductionLogManager::getInstance().initProductionTable()) { |
| | | // AfxMessageBox("初始化生产履历管理器失败!"); |
| | | // return FALSE; |
| | | // } |
| | | //} |
| | | //catch (const std::exception& ex) { |
| | | // CString errorMsg; |
| | | // errorMsg.Format(_T("初始化生产履历管理器失败:%s"), CString(ex.what())); |
| | | // AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | // return FALSE; |
| | | //} |
| | | |
| | | |
| | | // 初始化SECS运行设置管理库 |
| | | try { |
| | | if (!SECSRuntimeManager::getInstance().initRuntimeSetting()) { |
| | | AfxMessageBox("初始化SECS运行设置失败!"); |
| | | return FALSE; |
| | | } |
| | | } |
| | | catch (const std::exception& ex) { |
| | | CString errorMsg; |
| | | errorMsg.Format(_T("初始化SECS运行设置失败:%s"), CString(ex.what())); |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | CServoDlg dlg; |
| | |
| | | // 清理 GDI+ |
| | | TermGDIPlus(); |
| | | |
| | | // 销毁报警表 |
| | | AlarmManager::getInstance().termAlarmTable(); |
| | | |
| | | // 销毁生产表 |
| | | ProductionLogManager::getInstance().termProductionTable(); |
| | | |
| | | // 销毁SECS运行设置管理库 |
| | | SECSRuntimeManager::getInstance().termRuntimeSetting(); |
| | | |
| | | return CWinApp::ExitInstance(); |
| | | } |
| | | |