internal static extern bool RegisterRawInputDevices(RAWINPUTDEVICE[] pRawInputDevice, uint numberDevices, uint size);
public bool RegisterRawInput(IntPtr hwnd) { var rid = new RAWINPUTDEVICE[1]; rid[0].UsagePage = HidUsagePage.GENERIC; rid[0].Usage = HidUsage.Keyboard; rid[0].Flags = RawInputDeviceFlags.INPUTSINK; rid[0].Target = hwnd; return (NativeMethods.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0]))); }