diff --git a/src/win32_init.c b/src/win32_init.c index 84b465b8..20dc65df 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -179,8 +179,6 @@ int _glfwPlatformInit(void) _control87(MCW_EM, MCW_EM); #endif - _glfw.win32.instance = GetModuleHandle(NULL); - // Save the original gamma ramp _glfw.originalRampSize = 256; _glfwPlatformGetGammaRamp(&_glfw.originalRamp); @@ -204,7 +202,7 @@ void _glfwPlatformTerminate(void) if (_glfw.win32.classAtom) { - UnregisterClass(_GLFW_WNDCLASSNAME, _glfw.win32.instance); + UnregisterClass(_GLFW_WNDCLASSNAME, GetModuleHandle(NULL)); _glfw.win32.classAtom = 0; } diff --git a/src/win32_platform.h b/src/win32_platform.h index 9da32f99..d7edf01b 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -157,7 +157,6 @@ typedef struct _GLFWwindowWin32 //------------------------------------------------------------------------ typedef struct _GLFWlibraryWin32 { - HINSTANCE instance; ATOM classAtom; DWORD foregroundLockTimeout; char* clipboardString; diff --git a/src/win32_window.c b/src/win32_window.c index 786b1f71..6a5af33b 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -680,14 +680,14 @@ static ATOM registerWindowClass(void) wc.lpfnWndProc = (WNDPROC) windowProc; // Message handler wc.cbClsExtra = 0; // No extra class data wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer - wc.hInstance = _glfw.win32.instance; // Set instance + wc.hInstance = GetModuleHandle(NULL); // Set instance wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load arrow pointer wc.hbrBackground = NULL; // No background wc.lpszMenuName = NULL; // No menu wc.lpszClassName = _GLFW_WNDCLASSNAME; // Set class name // Load user-provided icon if available - wc.hIcon = LoadIcon(_glfw.win32.instance, L"GLFW_ICON"); + wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON"); if (!wc.hIcon) { // Load default icon @@ -774,7 +774,7 @@ static int createWindow(_GLFWwindow* window, fullHeight, // Decorated window height NULL, // No parent window NULL, // No menu - _glfw.win32.instance, + GetModuleHandle(NULL), window); // Pass GLFW window to WM_CREATE free(wideTitle);