# HG changeset patch # User Edgar Simo # Date 1217863072 0 # Node ID e8644f625d458e164aeceb013749c482cc255b38 # Parent 2ae5b4fc6af5753ff314d7fdb0c084e6903f2bb6 Seems like you have to register the class and other black magic too. diff -r 2ae5b4fc6af5 -r e8644f625d45 src/video/win32/SDL_win32window.c --- a/src/video/win32/SDL_win32window.c Mon Aug 04 14:44:21 2008 +0000 +++ b/src/video/win32/SDL_win32window.c Mon Aug 04 15:17:52 2008 +0000 @@ -32,6 +32,7 @@ /* Fake window to help with DirectInput events. */ HWND SDL_HelperWindow = NULL; +static ATOM SDL_HelperWindowClass = 0; static int @@ -425,16 +426,24 @@ const char *win_name = "SDLHelperWindowInputMsgWindow"; WNDCLASSEX wce; + /* Create the class. */ ZeroMemory(&wce, sizeof (wce)); wce.cbSize = sizeof(WNDCLASSEX); wce.lpfnWndProc = NULL; wce.lpszClassName = (LPCWSTR) class_name; wce.hInstance = hInstance; + /* Register the class. */ + SDL_HelperWindowClass = RegisterClassExA(&wce); + if (SDL_HelperWindowClass == 0) { + SDL_SetError("Unable to create Helper Window Class: error %d.", GetLastError()); + return -1; + } + + /* Create the window. */ SDL_HelperWindow = CreateWindowExA(0, class_name, win_name, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); - if (SDL_HelperWindow == NULL) { SDL_SetError("Unable to create Helper Window: error %d.", GetLastError()); return -1; @@ -450,10 +459,17 @@ void SDL_HelperWindowDestroy(void) { + /* Destroy the window. */ if (SDL_HelperWindow) { DestroyWindow(SDL_HelperWindow); SDL_HelperWindow = NULL; } + + /* Unregister the class. */ + if (SDL_HelperWindowClass) { + UnregisterClassA(SDL_HelperWindowClass, GetModuleHandleA(NULL)); + SDL_HelperWindowClass = 0; + } }