Seems like you have to register the class and other black magic too. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Mon, 04 Aug 2008 15:17:52 +0000
branchgsoc2008_force_feedback
changeset 2584e8644f625d45
parent 2583 2ae5b4fc6af5
child 2585 38f14c05a92c
Seems like you have to register the class and other black magic too.
src/video/win32/SDL_win32window.c
     1.1 --- a/src/video/win32/SDL_win32window.c	Mon Aug 04 14:44:21 2008 +0000
     1.2 +++ b/src/video/win32/SDL_win32window.c	Mon Aug 04 15:17:52 2008 +0000
     1.3 @@ -32,6 +32,7 @@
     1.4  
     1.5  /* Fake window to help with DirectInput events. */
     1.6  HWND SDL_HelperWindow = NULL;
     1.7 +static ATOM SDL_HelperWindowClass = 0;
     1.8  
     1.9  
    1.10  static int
    1.11 @@ -425,16 +426,24 @@
    1.12     const char *win_name = "SDLHelperWindowInputMsgWindow";
    1.13     WNDCLASSEX wce;
    1.14  
    1.15 +   /* Create the class. */
    1.16     ZeroMemory(&wce, sizeof (wce));
    1.17     wce.cbSize = sizeof(WNDCLASSEX);
    1.18     wce.lpfnWndProc = NULL;
    1.19     wce.lpszClassName = (LPCWSTR) class_name;
    1.20     wce.hInstance = hInstance;
    1.21  
    1.22 +   /* Register the class. */
    1.23 +   SDL_HelperWindowClass = RegisterClassExA(&wce);
    1.24 +   if (SDL_HelperWindowClass == 0) {
    1.25 +      SDL_SetError("Unable to create Helper Window Class: error %d.", GetLastError());
    1.26 +      return -1;
    1.27 +   }
    1.28 +
    1.29 +   /* Create the window. */
    1.30     SDL_HelperWindow = CreateWindowExA(0, class_name, win_name, WS_OVERLAPPEDWINDOW,
    1.31           CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
    1.32           CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL);
    1.33 -
    1.34     if (SDL_HelperWindow == NULL) {
    1.35        SDL_SetError("Unable to create Helper Window: error %d.", GetLastError());
    1.36        return -1;
    1.37 @@ -450,10 +459,17 @@
    1.38  void
    1.39  SDL_HelperWindowDestroy(void)
    1.40  {
    1.41 +   /* Destroy the window. */
    1.42     if (SDL_HelperWindow) {
    1.43        DestroyWindow(SDL_HelperWindow);
    1.44        SDL_HelperWindow = NULL;
    1.45     }
    1.46 +
    1.47 +   /* Unregister the class. */
    1.48 +   if (SDL_HelperWindowClass) {
    1.49 +      UnregisterClassA(SDL_HelperWindowClass, GetModuleHandleA(NULL));
    1.50 +      SDL_HelperWindowClass = 0;
    1.51 +   }
    1.52  }
    1.53  
    1.54