Пример #1
0
        public static Collection <JoystickInfo> GetJoysticks()
        {
            Collection <JoystickInfo> ret = new Collection <JoystickInfo>();
            int count = NativeMethods.JoyGetNumDevices();
            int size  = Marshal.SizeOf(typeof(JoyCapabilitiesInfo));

            for (int i = 0; i < count; i++)
            {
                JoyCapabilitiesInfo joystick = new JoyCapabilitiesInfo();

                JoyResult result = NativeMethods.JoyGetDevCapsW(i, ref joystick, size);

                if (result == JoyResult.OK)
                {
                    ret.Add(new JoystickInfo(i, joystick));
                }
            }

            return(ret);
        }
Пример #2
0
 internal JoystickInfo(Int32 id, JoyCapabilitiesInfo capabilities)
 {
     Id           = id;
     Capabilities = capabilities;
 }
Пример #3
0
 public static extern JoyResult JoyGetDevCapsW(int joyId, ref JoyCapabilitiesInfo pjc, int size);