#endif //WX_PRECOMP
#include "wx/cmdline.h"
+#include "wx/dynlib.h"
#include "wx/scopeguard.h"
#include "wx/msw/private.h"
#endif // wxUSE_BASE
-#if wxUSE_GUI && defined(__WXMSW__)
+#if wxUSE_GUI
+
+namespace
+{
#if wxUSE_UNICODE && !defined(__WXWINCE__)
#define NEED_UNICODE_CHECK
#ifdef NEED_UNICODE_CHECK
// check whether Unicode is available
-static bool wxIsUnicodeAvailable()
+bool wxIsUnicodeAvailable()
{
static const wchar_t *ERROR_STRING = L"wxWidgets Fatal Error";
#endif // NEED_UNICODE_CHECK
+void wxSetProcessDPIAware()
+{
+#if wxUSE_DYNLIB_CLASS
+ typedef BOOL (WINAPI *SetProcessDPIAware_t)(void);
+ wxDynamicLibrary dllUser32(wxT("user32.dll"));
+ SetProcessDPIAware_t pfnSetProcessDPIAware =
+ (SetProcessDPIAware_t)dllUser32.RawGetSymbol(wxT("SetProcessDPIAware"));
+
+ if ( pfnSetProcessDPIAware )
+ pfnSetProcessDPIAware();
+#endif // wxUSE_DYNLIB_CLASS
+}
+
+} //anonymous namespace
+
// ----------------------------------------------------------------------------
// Windows-specific wxEntry
// ----------------------------------------------------------------------------
argv = new wxChar *[argc + 1];
for ( int i = 0; i < argc; i++ )
{
- argv[i] = wxStrdup(args[i].wx_str());
+ argv[i] = wxStrdup(args[i].t_str());
}
// argv[] must be NULL-terminated
free(argv[i]);
}
- delete [] argv;
- argv = NULL;
+ wxDELETEA(argv);
argc = 0;
}
// remember the parameters Windows gave us
wxSetInstance(hInstance);
+#ifdef __WXMSW__
wxApp::m_nCmdShow = nCmdShow;
+#endif
// parse the command line: we can't use pCmdLine in Unicode build so it is
// simpler to never use it at all (this also results in a more correct
wxCmdLineArgType WXUNUSED(pCmdLine),
int nCmdShow)
{
+ // wxWidgets library doesn't have problems with non-default DPI settings,
+ // so we can mark the app as "DPI aware" for Vista/Win7 (see
+ // http://msdn.microsoft.com/en-us/library/dd464659%28VS.85%29.aspx).
+ // Note that we intentionally do it here and not in wxApp, so that it
+ // doesn't happen if wx code is hosted in another app (e.g. a plugin).
+ wxSetProcessDPIAware();
+
if ( !wxMSWEntryCommon(hInstance, nCmdShow) )
return -1;
return wxEntry(wxArgs.argc, wxArgs.argv);
}
-#endif // wxUSE_GUI && __WXMSW__
+#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// global HINSTANCE