#include #include #include "MyNetworkApi.h" #include "MainFrame.h" #include "MyConfigUtil.h" class App :public wxApp { public: /// /// ³õʼ»¯º¯Êý /// void InitData() { } static void unhandled_exception_handler() { try { throw; // Re-throw the exception to handle it } catch (const std::exception& e) { std::cerr << "Caught std::exception: " << e.what() << std::endl; } catch (...) { std::cerr << "Caught unknown exception" << std::endl; } std::abort(); // Terminate the program } bool OnInit() { std::set_terminate(unhandled_exception_handler); InitData(); SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); MainFrame* window; WindowPosSize rect = MyConfigUtil::getMainWindowPos(); cout << "»ñÈ¡µ½µÄ×ø±ê£º" << rect.x << " " << rect.y << endl; if (rect.x == -1 && rect.y == -1) { window = new MainFrame("¿Éתծ½»Ò×"); } else { wxPoint p = wxPoint(rect.x, rect.y); cout << "ÉèÖõÄ×ø±ê£º" << p.x << " " << p.y << endl; wxSize s = wxSize(rect.width, rect.height); window = new MainFrame("¿Éתծ½»Ò×",p,s); } window->Show(); return true; } }; wxIMPLEMENT_APP(App);