GdkWin32: Retrieve module HINSTANCE in static builds

This commit is contained in:
Luca Bacci
2022-03-01 09:25:28 +01:00
parent a17a0c5452
commit d5ce63508f
2 changed files with 47 additions and 10 deletions

View File

@ -69,6 +69,17 @@ _gdk_win32_windowing_init (void)
if (gdk_synchronize)
GdiSetBatchLimit (1);
#ifndef DLL_EXPORT
if (!GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCWSTR)_gdk_win32_windowing_init,
&_gdk_dll_hinstance))
{
g_error ("GetModuleHandleExW failed with error code %u\n",
(unsigned) GetLastError ());
}
#endif
_gdk_app_hmodule = GetModuleHandle (NULL);
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
_gdk_input_locale = GetKeyboardLayout (0);