Use Unicode command line when not using wmain() under Windows

While we use wmain() for the compilers that provide it since the changes of
bfa78c63b9, we still didn't handle Unicode
command line arguments not representable in the current Windows code page
correctly when using other compilers (e.g. MinGW).

Now use Win32 ::GetCommandLine() function for them and parse the command line
ourselves instead of relying on non-Unicode-friendly main() arguments which
can't represent arbitrary Unicode strings when not using UTF-8 (which is never
the case under Windows).
This commit is contained in:
Vadim Zeitlin
2017-03-11 01:04:31 +01:00
parent 1bcb30f6d7
commit 5b74044c3e
4 changed files with 57 additions and 29 deletions

View File

@@ -15,6 +15,14 @@
// Windows-specific wxEntry() overload and wxIMPLEMENT_WXWIN_MAIN definition
// ----------------------------------------------------------------------------
// wxEntry() overload using the command line for the current process, instead
// of argc/argv provided by the CRT. This is only really useful when using
// Unicode with a compiler not providing wmain() or similar entry point, but is
// always provided for consistency.
extern int WXDLLIMPEXP_BASE wxEntry();
#if wxUSE_GUI
// we need HINSTANCE declaration to define WinMain()
#include "wx/msw/wrapwin.h"
@@ -81,5 +89,6 @@ extern WXDLLIMPEXP_CORE int
} \
wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD
#endif // wxUSE_GUI
#endif // _WX_MSW_INIT_H_