From a2e03f3ddd4809b2c3915883d9b98bc56196f471 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 05 十二月 2024 09:13:22 +0800
Subject: [PATCH] 1.恢复原前一页下一页按钮禁用状态变化; 2.修复读PLC数据时如超时回调,窗口不存在会造成闪退的问题;
---
SourceCode/Bond/BondEq/ToolUnits.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/BondEq/ToolUnits.cpp b/SourceCode/Bond/BondEq/ToolUnits.cpp
index fecc6c1..69be431 100644
--- a/SourceCode/Bond/BondEq/ToolUnits.cpp
+++ b/SourceCode/Bond/BondEq/ToolUnits.cpp
@@ -80,6 +80,10 @@
void CToolUnits::createDir(const char* pszDir)
{
+ if (isDirectory(std::string(pszDir))) {
+ return;
+ }
+
CString strDir = pszDir;
int lastIndex = 0;
int index = strDir.Find(_T("\\"), lastIndex);
@@ -145,3 +149,55 @@
DWORD attributes = GetFileAttributes(path.c_str());
return (attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_DIRECTORY));
}
+
+double CToolUnits::toInt32(const char* pBuffer)
+{
+ return (pBuffer[0] & 0xff) | (pBuffer[1] & 0xff) << 8 | (pBuffer[2] & 0xff) << 16 | (pBuffer[3] & 0xff) << 24;
+}
+
+double CToolUnits::toInt16(const char* pBuffer)
+{
+ return (pBuffer[0] & 0xff) | (pBuffer[1] & 0xff) << 8;
+}
+
+BOOL CToolUnits::getBit(const char c, int index)
+{
+ switch (index)
+ {
+ case 0:
+ return c & 0x01;
+ break;
+ case 1:
+ return c & 0x02;
+ break;
+ case 2:
+ return c & 0x04;
+ break;
+ case 3:
+ return c & 0x08;
+ break;
+ case 4:
+ return c & 0x10;
+ break;
+ case 5:
+ return c & 0x20;
+ break;
+ case 6:
+ return c & 0x40;
+ break;
+ case 7:
+ return c & 0x80;
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+void CToolUnits::setDlgItemDouble(CWnd* pWnd, int nCtrlId, double value)
+{
+ CString strText;
+ strText.Format(_T("%.03f"), value);
+ pWnd->SetDlgItemText(nCtrlId, strText);
+}
--
Gitblit v1.9.3