admin
2025-07-17 6cd92a169cbc0db35042f243a09d976fd3e1445c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<iostream>
#include <wx/wx.h>
#include "MyNetworkApi.h"
 
 
#include "MainFrame.h"
#include "MyConfigUtil.h"
 
 
 
class App :public wxApp {
 
public:
 
    /// <summary>
    /// ³õʼ»¯º¯Êý
    /// </summary>
    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);