From 040d03dca49757d59b68a869ca04ddc396438253 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 18 Dec 2002 16:40:12 +0000 Subject: [PATCH] Fixed the RegisterClass call --- src/native/win32/LWJGL.cpp | 3 +++ src/native/win32/org_lwjgl_Display.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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);