diff --git a/src/native/win32/LWJGL.cpp b/src/native/win32/LWJGL.cpp index 6a4c8451..86624ed1 100644 --- a/src/native/win32/LWJGL.cpp +++ b/src/native/win32/LWJGL.cpp @@ -43,6 +43,8 @@ #include #include +HINSTANCE dll_handle; + /* * DLL entry point for Windows. Called when Java loads the .dll */ @@ -52,5 +54,6 @@ BOOL WINAPI DllMain( LPVOID lpvReserved // reserved ) { + dll_handle = hinstDLL; return TRUE; // Success } \ No newline at end of file diff --git a/src/native/win32/org_lwjgl_Display.cpp b/src/native/win32/org_lwjgl_Display.cpp index 3b233bfe..6ff239cd 100644 --- a/src/native/win32/org_lwjgl_Display.cpp +++ b/src/native/win32/org_lwjgl_Display.cpp @@ -49,6 +49,7 @@ #define WINDOWCLASSNAME "LWJGLWINDOW" +extern HINSTANCE dll_handle; // Initialise static variables bool oneShotInitialised = false; HWND hwnd = NULL; // Handle to the window @@ -210,7 +211,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate windowClass.lpfnWndProc = WindowProc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; - windowClass.hInstance = (HINSTANCE) GetCurrentProcess(); + windowClass.hInstance = dll_handle; windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); windowClass.hCursor = LoadIcon(NULL, IDC_ARROW); windowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);