コード例 #1
0
        public JoystickInputDevice(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;

            // Search register.
            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 names
            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();
        }
コード例 #2
0
ファイル: JoystickMethods.cs プロジェクト: nlhans/SimShift
 public static extern UInt32 joyGetDevCaps(Int32 uJoyID, out JOYCAPS pjc, Int32 cbjc);
コード例 #3
0
ファイル: JoystickMethods.cs プロジェクト: zappybiby/SimShift
 public static extern UInt32 joyGetDevCaps(Int32 uJoyID, out JOYCAPS pjc, Int32 cbjc);