| SourceCode/Bond/BoounionPLC/BoounionPLC.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/BoounionPLC/Common.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/BoounionPLC/Model.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/BoounionPLC/PagePlcList.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
SourceCode/Bond/BoounionPLC/BoounionPLC.cpp
@@ -8,11 +8,60 @@ #include "HorizontalLine.h" #include "VerticalLine.h" #include <DbgHelp.h> #pragma comment(lib, "DbgHelp.lib") #ifdef _DEBUG #define new DEBUG_NEW #endif LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo) { SYSTEMTIME st; GetLocalTime(&st); // 获取当前程序运行目录 char szAppPath[MAX_PATH]; GetModuleFileName(NULL, szAppPath, MAX_PATH); std::string strCurrentDir = szAppPath; size_t lastSlash = strCurrentDir.find_last_of("\\/"); strCurrentDir = strCurrentDir.substr(0, lastSlash); // 检查Temp文件夹 struct stat buffer; std::string strFullTempPath = strCurrentDir + "\\Temp"; if (stat(strFullTempPath.c_str(), &buffer) != 0) { if (!CreateDirectory(strFullTempPath.c_str(), NULL)) { return EXCEPTION_EXECUTE_HANDLER; } } // 构建文件名 char szFileName[MAX_PATH]; snprintf(szFileName, MAX_PATH, "\\BoounionPLC_%04d%02d%02d_%02d%02d%02d.dmp", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); // 写入DMP文件 std::string strFullPath = strFullTempPath + szFileName; HANDLE hFile = CreateFile(strFullPath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { MINIDUMP_EXCEPTION_INFORMATION dumpInfo; dumpInfo.ExceptionPointers = pExceptionInfo; dumpInfo.ThreadId = GetCurrentThreadId(); dumpInfo.ClientPointers = TRUE; // 写入dump文件 BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithFullMemory, &dumpInfo, NULL, NULL); CloseHandle(hFile); if (success) { CString strMsg; strMsg.Format(_T("Software crashes. Dump file: %s"), strFullPath.c_str()); AfxMessageBox(strMsg); } } return EXCEPTION_EXECUTE_HANDLER; } // CBoounionPLCApp @@ -30,6 +79,7 @@ // TODO: 在此处添加构造代码, // 将所有重要的初始化放置在 InitInstance 中 SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); } SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -113,6 +113,7 @@ if (RX_CODE_SELECT_PLC == code) { CPLC* pPlc; if (pAny->getPtrValue("ptr", (void*&)pPlc)) { if (pPlc != nullptr) { ASSERT(m_pMainContainer != nullptr); if (m_pActiveView == nullptr) { m_pActiveView = (CPlcView*)CreatePlcView(pPlc); @@ -123,6 +124,9 @@ m_pActiveView->SetContext(pPlc); m_pActiveView->SendMessage(WM_NCPAINT, 0, 0); } } else { CloseView(m_pActiveView); } theApp.m_model.setCurrentPlc(pPlc); } SourceCode/Bond/BoounionPLC/Common.h
@@ -1,5 +1,5 @@ #pragma once #ifndef COMMON_H #define COMMON_H /* Rx Code */ #define RX_CODE_TEST 0 @@ -73,3 +73,5 @@ /* 监控数据id */ #define MONITOR_ID_ALARM 1001 #endif // COMMON_H SourceCode/Bond/BoounionPLC/Model.cpp
@@ -348,8 +348,8 @@ m_configuration.removePLC(pszName); notifyPtr(RX_CODE_REMOVE_PLC, iter->second); //delete iter->second; //m_mapPlc.erase(iter); 这个地方需要研究一下 delete iter->second; m_mapPlc.erase(iter); return 0; } @@ -358,6 +358,8 @@ { if (pPlc != nullptr) { m_strCurrPlc = pPlc->getName(); } else { m_strCurrPlc = ""; } } SourceCode/Bond/BoounionPLC/PagePlcList.cpp
@@ -75,12 +75,11 @@ // 更新节点 HTREEITEM hSelectedItem = m_treeCtrl.GetSelectedItem(); CPLC* pSelectedPlc = nullptr; if (hSelectedItem != NULL) { CPLC* pSelectedPlc = (CPLC*)m_treeCtrl.GetItemData(hSelectedItem); if (pSelectedPlc != nullptr) { pSelectedPlc = (CPLC*)m_treeCtrl.GetItemData(hSelectedItem); } theApp.m_model.notifyPtr(RX_CODE_SELECT_PLC, pSelectedPlc); } } } }