internal void RegisterRawDevice(OpenTK.Input.MouseDevice mouse) { RawInputDevice[] rid = new RawInputDevice[1]; // Mouse is 1/2 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 2; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { throw new ApplicationException( String.Format( "Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()) ); } else { Debug.Print("Registered mouse {0}", mouse.ToString()); System.Drawing.Point p = new System.Drawing.Point(); if (Functions.GetCursorPos(ref p)) { mouse.Position = p; } } }
private static void RegisterKeyboardDevice(IntPtr window, string name) { RawInputDevice[] RawInputDevices = new RawInputDevice[1] { new RawInputDevice() }; RawInputDevices[0].UsagePage = (short)1; RawInputDevices[0].Usage = (short)6; RawInputDevices[0].Flags = RawInputDeviceFlags.INPUTSINK; RawInputDevices[0].Target = window; Functions.RegisterRawInputDevices(RawInputDevices, 1, API.RawInputDeviceSize); }
static void RegisterRawDevice(IntPtr window, string device) { RawInputDevice[] rid = new RawInputDevice[] { new RawInputDevice(HIDUsageGD.Mouse, RawInputDeviceFlags.INPUTSINK, window) }; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { Debug.Print("[Warning] Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()); } else { Debug.Print("Registered mouse {0}", device); } }
static void RegisterKeyboardDevice(IntPtr window, string name) { RawInputDevice[] rid = new RawInputDevice[1]; // Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 6; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { Debug.Print("[Warning] Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()); } else { Debug.Print("Registered keyboard {0}", name); } }
internal void RegisterKeyboardDevice(KeyboardDevice kb) { RawInputDevice[] rid = new RawInputDevice[1]; // Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 6; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { throw new ApplicationException( String.Format( "Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()) ); } else { Debug.Print("Registered keyboard {0}", kb.ToString()); } }
static void RegisterKeyboardDevice(IntPtr window, string name) { RawInputDevice[] rid = new RawInputDevice[1]; // Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 6; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { Debug.Print("[Warning] Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()); } else { Debug.Print("Registered keyboard {0}", name); } }
internal static extern BOOL RegisterRawInputDevices( RawInputDevice[] RawInputDevices, INT NumDevices, INT Size );
private static void RegisterKeyboardDevice(IntPtr window, string name) { RawInputDevice[] RawInputDevices = new RawInputDevice[1] { new RawInputDevice() }; RawInputDevices[0].UsagePage = (short) 1; RawInputDevices[0].Usage = (short) 6; RawInputDevices[0].Flags = RawInputDeviceFlags.INPUTSINK; RawInputDevices[0].Target = window; Functions.RegisterRawInputDevices(RawInputDevices, 1, API.RawInputDeviceSize); }
static void RegisterKeyboardDevice(IntPtr window, string name) { RawInputDevice[] rid = new RawInputDevice[] { new RawInputDevice(HIDUsageGD.Keyboard, RawInputDeviceFlags.INPUTSINK, window) }; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { Debug.Print("[Warning] Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()); } else { Debug.Print("Registered keyboard {0}", name); } }
internal void RegisterKeyboardDevice(KeyboardDevice kb) { RawInputDevice[] rid = new RawInputDevice[1]; // Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 6; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { throw new ApplicationException( String.Format( "Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()) ); } else { Debug.Print("Registered keyboard {0}", kb.ToString()); } }
internal static bool RegisterRawInputDevices(RawInputDevice[] RawInputDevices, int NumDevices, int Size);
internal void RegisterRawDevice(OpenTK.Input.MouseDevice mouse) { RawInputDevice[] rid = new RawInputDevice[1]; // Mouse is 1/2 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx rid[0] = new RawInputDevice(); rid[0].UsagePage = 1; rid[0].Usage = 2; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = window; if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize)) { throw new ApplicationException( String.Format( "Raw input registration failed with error: {0}. Device: {1}", Marshal.GetLastWin32Error(), rid[0].ToString()) ); } else { Debug.Print("Registered mouse {0}", mouse.ToString()); Point p = new Point(); if (Functions.GetCursorPos(ref p)) mouse.Position = p; } }