src/joystick/win32/SDL_dxjoystick.c
branchgsoc2008_force_feedback
changeset 2623 6deba05725ac
parent 2616 acd5da848404
child 2625 9bad8efcb75e
--- a/src/joystick/win32/SDL_dxjoystick.c	Wed Aug 06 09:35:09 2008 +0000
+++ b/src/joystick/win32/SDL_dxjoystick.c	Wed Aug 06 09:52:51 2008 +0000
@@ -52,7 +52,6 @@
 #define JOY_AXIS_THRESHOLD	(((AXIS_MAX)-(AXIS_MIN))/100)   /* 1% motion */
 
 /* external variables referenced. */
-extern HINSTANCE SDL_Instance;
 extern HWND SDL_HelperWindow;
 
 
@@ -117,8 +116,13 @@
     }
 
     /* Because we used CoCreateInstance, we need to Initialize it, first. */
+    instance = GetModuleHandle(NULL);
+    if (instance == NULL) {
+        SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError());
+        return (-1);
+    }
     result =
-        IDirectInput_Initialize(dinput, SDL_Instance, DIRECTINPUT_VERSION);
+        IDirectInput_Initialize(dinput, instance, DIRECTINPUT_VERSION);
 
     if (FAILED(result)) {
         SetDIerror("IDirectInput::Initialize", result);