From 5c9991be21f57781573f04961ec511ac2938ea3d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 08 四月 2025 15:27:08 +0800
Subject: [PATCH] '功能完善'

---
 DelegateQueue/main.cpp |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/DelegateQueue/main.cpp b/DelegateQueue/main.cpp
index f8c2f65..0c5ebb3 100644
--- a/DelegateQueue/main.cpp
+++ b/DelegateQueue/main.cpp
@@ -1,11 +1,26 @@
 #include<iostream>
 #include <wx/wx.h>
-
+#include <wx/log.h>
+#include <fstream>
 
 #include "MainFrame.h"
 
 #include "MyConfigUtil.h"
 
+
+LONG WINAPI UnhandledExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
+{
+	std::ofstream logFile("app_log.txt", std::ios::app);
+	if (logFile.is_open())
+	{
+		logFile << "Unhandled exception occurred!" << std::endl;
+		logFile << "Exception code: " << std::hex << ExceptionInfo->ExceptionRecord->ExceptionCode << std::endl;
+		logFile << "Exception address: " << std::hex << ExceptionInfo->ExceptionRecord->ExceptionAddress << std::endl;
+		logFile.close();
+	}
+
+	return EXCEPTION_EXECUTE_HANDLER;
+}
 
 
 
@@ -13,6 +28,8 @@
 
 public:
 	bool OnInit() {
+
+		SetUnhandledExceptionFilter(UnhandledExceptionHandler);
 	
 		SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
 		

--
Gitblit v1.8.0