Really fix MinGW compilation of SetThreadUILanguage-using code

09e1fbe fixed compilation, but not linking. Just use the same code as on
the 3.0 branch, with dynamic loading of SetThreadUILanguage.
This commit is contained in:
Vaclav Slavik
2015-06-15 13:52:50 +02:00
parent 6787d2268a
commit 1f5a876d32

View File

@@ -49,9 +49,8 @@
#endif #endif
#ifdef __WIN32__ #ifdef __WIN32__
#include "wx/dynlib.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
// Some compilers' winnls.h header doesn't declare this function:
extern "C" WINBASEAPI LANGID WINAPI SetThreadUILanguage(LANGID LangId);
#endif #endif
#include "wx/file.h" #include "wx/file.h"
@@ -479,7 +478,12 @@ bool wxLocale::Init(int language, int flags)
// behavior, so avoid calling it there. // behavior, so avoid calling it there.
if ( wxGetWinVersion() >= wxWinVersion_Vista ) if ( wxGetWinVersion() >= wxWinVersion_Vista )
{ {
SetThreadUILanguage(LANGIDFROMLCID(lcid)); wxLoadedDLL dllKernel32(wxS("kernel32.dll"));
typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID);
SetThreadUILanguage_t pfnSetThreadUILanguage = NULL;
wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32);
if (pfnSetThreadUILanguage)
pfnSetThreadUILanguage(LANGIDFROMLCID(lcid));
} }
#endif #endif