--- a/include/SDL_main.h Thu Aug 09 13:09:47 2001 +0000
+++ b/include/SDL_main.h Thu Aug 09 14:04:46 2001 +0000
@@ -64,9 +64,9 @@
#endif
/* This should be called from your WinMain() function, if any */
-extern DECLSPEC void SDL_SetModuleHandle(HMODULE hInst);
+extern DECLSPEC void SDL_SetModuleHandle(void *hInst);
/* This can also be called, but is no longer necessary */
-extern DECLSPEC int SDL_RegisterApp(char *name, Uint32 style, HMODULE hInst);
+extern DECLSPEC int SDL_RegisterApp(char *name, Uint32 style, void *hInst);
#ifdef __cplusplus
}
--- a/src/main/win32/SDL_main.c Thu Aug 09 13:09:47 2001 +0000
+++ b/src/main/win32/SDL_main.c Thu Aug 09 14:04:46 2001 +0000
@@ -199,16 +199,25 @@
atexit(SDL_Quit);
#ifndef DISABLE_VIDEO
+#if 0
/* Create and register our class *
- DJM: If we do this here, the user nevers gets a chance to
- putenv(SDL_WINDOWID). This is already called later by
- the (DIB|DX5)_CreateWindow function, so it should be
- safe to comment it out here.
+ DJM: If we do this here, the user nevers gets a chance to
+ putenv(SDL_WINDOWID). This is already called later by
+ the (DIB|DX5)_CreateWindow function, so it should be
+ safe to comment it out here.
if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT,
GetModuleHandle(NULL)) < 0 ) {
ShowError("WinMain() error", SDL_GetError());
exit(1);
}*/
+#else
+ /* Sam:
+ We still need to pass in the application handle so that
+ DirectInput will initialize properly when SDL_RegisterApp()
+ is called later in the video initialization.
+ */
+ SDL_SetModuleHandle(GetModuleHandle(NULL));
+#endif /* 0 */
#endif /* !DISABLE_VIDEO */
/* Run the application main() code */
--- a/src/video/wincommon/SDL_sysevents.c Thu Aug 09 13:09:47 2001 +0000
+++ b/src/video/wincommon/SDL_sysevents.c Thu Aug 09 14:04:46 2001 +0000
@@ -504,13 +504,13 @@
}
/* Allow the application handle to be stored and retrieved later */
-static HMODULE SDL_handle = NULL;
+static void *SDL_handle = NULL;
-void SDL_SetModuleHandle(HMODULE handle)
+void SDL_SetModuleHandle(void *handle)
{
SDL_handle = handle;
}
-HMODULE SDL_GetModuleHandle(void)
+void *SDL_GetModuleHandle(void)
{
void *handle;
@@ -531,7 +531,7 @@
const char *SDL_windowid = NULL;
/* Register the class for this application -- exported for winmain.c */
-int SDL_RegisterApp(char *name, Uint32 style, HMODULE hInst)
+int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
{
static int initialized = 0;
WNDCLASS class;
@@ -571,7 +571,7 @@
class.lpszClassName = name;
#endif /* _WIN32_WCE */
class.hbrBackground = NULL;
- class.hInstance = hInst ? hInst : GetModuleHandle(0);
+ class.hInstance = hInst;
class.style = style;
#ifdef HAVE_OPENGL
class.style |= CS_OWNDC;