From 5a8bbd2426aeacdbbb2fdb1a7f7a1adce0cac7f9 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 01 八月 2025 16:23:29 +0800
Subject: [PATCH] 1. 新增以下功能函数并集成:    - InitStorage():初始化存储区域    - StartStorage():开始数据存储    - StopStorage():停止存储并自动提取、分析数据    - AnalyzeStoredData():分析指定端口数据,返回偏移量

---
 SourceCode/Bond/SGMeasurement/SGMeasurement.cpp |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/SGMeasurement/SGMeasurement.cpp b/SourceCode/Bond/SGMeasurement/SGMeasurement.cpp
new file mode 100644
index 0000000..2c3c2e6
--- /dev/null
+++ b/SourceCode/Bond/SGMeasurement/SGMeasurement.cpp
@@ -0,0 +1,104 @@
+锘�
+// SGMeasurement.cpp: 瀹氫箟搴旂敤绋嬪簭鐨勭被琛屼负銆�
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "SGMeasurement.h"
+#include "SGMeasurementDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CSGMeasurementApp
+
+BEGIN_MESSAGE_MAP(CSGMeasurementApp, CWinApp)
+	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CSGMeasurementApp 鏋勯��
+
+CSGMeasurementApp::CSGMeasurementApp()
+{
+	// 鏀寔閲嶆柊鍚姩绠$悊鍣�
+	m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳瀯閫犱唬鐮侊紝
+	// 灏嗘墍鏈夐噸瑕佺殑鍒濆鍖栨斁缃湪 InitInstance 涓�
+}
+
+
+// 鍞竴鐨� CSGMeasurementApp 瀵硅薄
+
+CSGMeasurementApp theApp;
+
+
+// CSGMeasurementApp 鍒濆鍖�
+
+BOOL CSGMeasurementApp::InitInstance()
+{
+	// 濡傛灉搴旂敤绋嬪簭瀛樺湪浠ヤ笅鎯呭喌锛學indows XP 涓婇渶瑕� InitCommonControlsEx()
+	// 浣跨敤 ComCtl32.dll 鐗堟湰 6 鎴栨洿楂樼増鏈潵鍚敤鍙鍖栨柟寮忥紝鍒欓渶瑕� InitCommonControlsEx()銆傚惁鍒欙紝灏嗘棤娉曞垱寤虹獥鍙c��
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 灏嗗畠璁剧疆涓哄寘鎷墍鏈夎鍦ㄥ簲鐢ㄧ▼搴忎腑浣跨敤鐨�
+	// 鍏叡鎺т欢绫汇��
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+	// 鍒濆鍖� MFC RichEdit 鎺т欢
+	AfxInitRichEdit2();
+
+	AfxEnableControlContainer();
+
+	// 鍒涘缓 shell 绠$悊鍣紝浠ラ槻瀵硅瘽妗嗗寘鍚�
+	// 浠讳綍 shell 鏍戣鍥炬帶浠舵垨 shell 鍒楄〃瑙嗗浘鎺т欢銆�
+	CShellManager *pShellManager = new CShellManager;
+
+	// 婵�娲烩�淲indows Native鈥濊瑙夌鐞嗗櫒锛屼互渚垮湪 MFC 鎺т欢涓惎鐢ㄤ富棰�
+	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+	// 鏍囧噯鍒濆鍖�
+	// 濡傛灉鏈娇鐢ㄨ繖浜涘姛鑳藉苟甯屾湜鍑忓皬
+	// 鏈�缁堝彲鎵ц鏂囦欢鐨勫ぇ灏忥紝鍒欏簲绉婚櫎涓嬪垪
+	// 涓嶉渶瑕佺殑鐗瑰畾鍒濆鍖栦緥绋�
+	// 鏇存敼鐢ㄤ簬瀛樺偍璁剧疆鐨勬敞鍐岃〃椤�
+	// TODO: 搴旈�傚綋淇敼璇ュ瓧绗︿覆锛�
+	// 渚嬪淇敼涓哄叕鍙告垨缁勭粐鍚�
+	SetRegistryKey(_T("搴旂敤绋嬪簭鍚戝鐢熸垚鐨勬湰鍦板簲鐢ㄧ▼搴�"));
+
+	CSGMeasurementDlg dlg;
+	m_pMainWnd = &dlg;
+	INT_PTR nResponse = dlg.DoModal();
+	if (nResponse == IDOK)
+	{
+		// TODO:鈥滅‘瀹氣�濇潵鍏抽棴瀵硅瘽妗嗙殑浠g爜
+	}
+	else if (nResponse == IDCANCEL)
+	{
+		// TODO:鈥滃彇娑堚�濇潵鍏抽棴瀵硅瘽妗嗙殑浠g爜 
+	}
+	else if (nResponse == -1)
+	{
+		TRACE(traceAppMsg, 0, "璀﹀憡: 瀵硅瘽妗嗗垱寤哄け璐ワ紝搴旂敤绋嬪簭灏嗘剰澶栫粓姝€�俓n");
+		TRACE(traceAppMsg, 0, "璀﹀憡: 濡傛灉鎮ㄥ湪瀵硅瘽妗嗕笂浣跨敤 MFC 鎺т欢锛屽垯鏃犳硶 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS銆俓n");
+	}
+
+	// 鍒犻櫎涓婇潰鍒涘缓鐨� shell 绠$悊鍣ㄣ��
+	if (pShellManager != nullptr)
+	{
+		delete pShellManager;
+	}
+
+#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
+	ControlBarCleanUp();
+#endif
+
+	// 鐢变簬瀵硅瘽妗嗗凡鍏抽棴锛屾墍浠ュ皢杩斿洖 FALSE 浠ヤ究閫�鍑哄簲鐢ㄧ▼搴忥紝鑰屼笉鏄惎鍔ㄥ簲鐢ㄧ▼搴忕殑娑堟伅娉点��
+	return FALSE;
+}
\ No newline at end of file

--
Gitblit v1.9.3