Ejemplo n.º 1
0
 public static extern UInt32 joyGetDevCaps(Int32 uJoyID, out JOYCAPS pjc, Int32 cbjc);
Ejemplo n.º 2
0
 public static extern UInt32 joyGetDevCaps(Int32 uJoyID, out JOYCAPS pjc, Int32 cbjc);
Ejemplo n.º 3
0
        public JoystickDevice(JOYCAPS captured, int device)
        {
            id = device;

            // Copy all members.
            data = new JOYCAPS();
            data.szPname = captured.szPname;
            data.wMid = captured.wMid;
            data.wPid = captured.wPid;
            data.wXmin = captured.wXmin;
            data.wXmax = captured.wXmax;
            data.wYmin = captured.wYmin;
            data.wYmax = captured.wYmax;
            data.wZmin = captured.wZmin;
            data.wZmax = captured.wZmax;
            data.wNumButtons = captured.wNumButtons;
            data.wPeriodMin = captured.wPeriodMin;
            data.wPeriodMax = captured.wPeriodMax;

            RegistryKey rf = Registry.CurrentUser.OpenSubKey(RegReferencePlace);
            string USBDevice = Convert.ToString(rf.GetValue("Joystick" + (1 + id).ToString() + "OEMName"));
            RegistryKey usb = Registry.CurrentUser.OpenSubKey(RegKeyPlace);
            usb = usb.OpenSubKey(USBDevice);
            _Name = (string)usb.GetValue("OEMName");

            // Get axis stuff
            RegistryKey axisMaster = Registry.LocalMachine.OpenSubKey(RegKeyAxisData).OpenSubKey(USBDevice);

            AxisNames = new Dictionary<int, string>();
            if (axisMaster != null)
            {
                axisMaster = axisMaster.OpenSubKey("Axes");
                if (axisMaster != null)
                {
                    foreach (string name in axisMaster.GetSubKeyNames())
                    {
                        RegistryKey axis = axisMaster.OpenSubKey(name);
                        AxisNames.Add(Convert.ToInt32(name), (string)axis.GetValue(""));
                        axis.Close();
                    }
                    axisMaster.Close();
                }
            }
            rf.Close();
            usb.Close();
        }