admin
2025-04-08 5c9991be21f57781573f04961ec511ac2938ea3d
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
57
58
59
#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;
}
 
 
 
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);