]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/joystick.cpp
(blind) fix for keyboard cues display under XP (bug 1298512)
[wxWidgets.git] / src / msw / joystick.cpp
index d09e443a91e228b5c81a4a0fa91a13abd284ab6d..a9a18a6935bf5392349cfb77b70e03b0ee2420c8 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "joystick.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
     #include <mmsystem.h>
 #endif
 
-#if !defined(__WIN32__) && !defined(_MMRESULT_)
-typedef UINT MMRESULT;
-#endif
-
 // Why doesn't BC++ have joyGetPosEx?
 #if !defined(__WIN32__) || defined(__BORLANDC__)
 #define NO_JOYGETPOSEX
 #endif
 
 #include "wx/window.h"
+#include "wx/msw/registry.h"
 #include "wx/msw/joystick.h"
 
+#include <regstr.h>
+
 IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject)
 
 // Attributes
@@ -299,10 +294,22 @@ int wxJoystick::GetProductId() const
 wxString wxJoystick::GetProductName() const
 {
     JOYCAPS joyCaps;
-    if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
+    if (joyGetDevCaps(m_joystick, &joyCaps, sizeof(joyCaps)) != JOYERR_NOERROR)
         return wxEmptyString;
-    else
-        return wxString(joyCaps.szPname);
+
+    wxRegKey key1(wxString::Format(wxT("HKEY_LOCAL_MACHINE\\%s\\%s\\%s"),
+                   REGSTR_PATH_JOYCONFIG, joyCaps.szRegKey, REGSTR_KEY_JOYCURR));
+
+    wxString str;
+    key1.QueryValue(wxString::Format(wxT("Joystick%d%s"),
+                                     m_joystick + 1, REGSTR_VAL_JOYOEMNAME),
+                    str);
+
+    wxRegKey key2(wxString::Format(wxT("HKEY_LOCAL_MACHINE\\%s\\%s"),
+                                        REGSTR_PATH_JOYOEM, str.c_str()));
+    key2.QueryValue(REGSTR_VAL_JOYOEMNAME, str);
+
+    return str;
 }
 
 int wxJoystick::GetXMin() const