#include #include #include #include #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; } class App :public wxApp { public: bool OnInit() { SetUnhandledExceptionFilter(UnhandledExceptionHandler); SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); WindowPosSize rect = MyConfigUtil::getMainWindowPos(); cout << "»ñÈ¡µ½µÄ×ø±ê£º" << rect.x <<" "<< rect.y << endl; wxString title = "¼Ó±´¿ØÖÆÖÐÐÄ"; title.Append(to_string(DPI)); if (rect.x==-1&&rect.y==-1) { wxPoint p = wxDefaultPosition; wxSize s = wxSize(FRAME_WIDTH, FRAME_HEIGHT); MainFrame* window = new MainFrame(title, p, s); window->Show(); } else { wxPoint p= wxPoint(rect.x, rect.y); cout << "ÉèÖõÄ×ø±ê£º" << p.x << " " << p.y << endl; wxSize s = wxSize(rect.width, rect.height); MainFrame* window = new MainFrame(title, p, s); window->Show(); } return true; } }; wxIMPLEMENT_APP(App);