| 1 |
#include "MainFrame.h" |
| 2 |
#include <wx/app.h> |
| 3 |
#include <wx/event.h> |
| 4 |
#include <wx/image.h> |
| 5 |
|
| 6 |
#ifdef __WXMSW__ |
| 7 |
typedef BOOL WINAPI (*SetProcessDPIAwareFunc)(); |
| 8 |
#endif |
| 9 |
|
| 10 |
// Define the MainApp |
| 11 |
class MainApp : public wxApp |
| 12 |
{ |
| 13 |
public: |
| 14 |
MainApp() {} |
| 15 |
virtual ~MainApp() {} |
| 16 |
|
| 17 |
virtual bool OnInit() |
| 18 |
{ |
| 19 |
|
| 20 |
#ifdef __WXMSW__ |
| 21 |
HINSTANCE user32Dll = LoadLibrary(L"User32.dll"); |
| 22 |
if(user32Dll) { |
| 23 |
SetProcessDPIAwareFunc pFunc = (SetProcessDPIAwareFunc)GetProcAddress(user32Dll, "SetProcessDPIAware"); |
| 24 |
if(pFunc) { pFunc(); } |
| 25 |
FreeLibrary(user32Dll); |
| 26 |
user32Dll = NULL; |
| 27 |
} |
| 28 |
#endif |
| 29 |
|
| 30 |
// Add the common image handlers |
| 31 |
wxImage::AddHandler(new wxPNGHandler); |
| 32 |
wxImage::AddHandler(new wxJPEGHandler); |
| 33 |
|
| 34 |
MainFrame* mainFrame = new MainFrame(NULL); |
| 35 |
SetTopWindow(mainFrame); |
| 36 |
return GetTopWindow()->Show(); |
| 37 |
} |
| 38 |
}; |
| 39 |
|
| 40 |
DECLARE_APP(MainApp) |
| 41 |
IMPLEMENT_APP(MainApp) |