public int GetDeviceID(Message message) { uint dwSize = 0; GetRawInputData( message.LParam, RID_INPUT, IntPtr.Zero, ref dwSize, (uint)Marshal.SizeOf(typeof(RawInputHeader)) ); IntPtr buffer = Marshal.AllocHGlobal((int)dwSize); GetRawInputData( message.LParam, RID_INPUT, buffer, ref dwSize, (uint)Marshal.SizeOf(typeof(RawInputHeader)) ); RawInput raw = (RawInput)Marshal.PtrToStructure(buffer, typeof(RawInput)); Marshal.FreeHGlobal(buffer); if (raw.Mouse.ButtonFlags == RawMouseButtons.LeftDown || raw.Mouse.ButtonFlags == RawMouseButtons.RightDown) { return((int)raw.Header.Device); } else { return(0); } }
protected override void OnSourceInitialized(EventArgs e) { // I am new to WPF and I don't know where else to call this function. // It has to be called after the window is created or the handle won't // exist yet and the function will throw an exception. IntPtr hwnd = IntPtr.Zero; Window myWin = Application.Current.MainWindow; try { hwnd = new WindowInteropHelper(myWin).Handle; } catch (Exception ex) { Debug.WriteLine("Initialized Exception: " + ex.Message); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _rawinput = new RawInput(hwnd, CaptureOnlyInForeground); _rawinput.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled Win32.DeviceAudit(); _rawinput.KeyPressed += OnKeyPressed; keyNames.Clear(); base.OnSourceInitialized(e); }
public Form1() { InitializeComponent(); LoadSounds(); foreach (var key in Enum.GetValues(typeof(VirtualKeys))) { if (!lastStates.ContainsKey((VirtualKeys)key)) { lastStates.Add((VirtualKeys)key, false); } } RawInput.RegisterDevice(HIDUsagePage.Generic, HIDUsage.Keyboard, RawInputDeviceFlags.InputSink, this.Handle); audioCleanupThread = new Thread(() => { while (true) { SoundManager.Cleanup(); Thread.Sleep(50); } }); audioCleanupThread.Start(); }
protected override void Run() { string[] passports = RawInput.Split("\r\n\r\n"); int countValidPassportsPart1 = 0, countValidPassportsPart2 = 0; foreach (string passport in passports) { string[] rawFields = passport.Replace("\r\n", " ").Split(" "); List <Tuple <string, string> > fields = rawFields .Select(rawField => { string[] keyValue = rawField.Split(':'); return(Tuple.Create(keyValue[0], keyValue[1])); }).ToList(); if (fields.Count == 8 || (fields.Count == 7 && !fields.Select(f => f.Item1).Contains("cid"))) { // Part 1 countValidPassportsPart1++; // Part2 if (IsValidPart2(fields)) { countValidPassportsPart2++; } } } AnswerPart1 = countValidPassportsPart1.ToString(); AnswerPart2 = countValidPassportsPart2.ToString(); }
protected override void OnMessageReceived(string message) { RawInput raw = InputMessageParser.ParseMessage(message); if (raw == null) { return; } var optionalButton = InputMessageParser.ParseButton(raw); if (optionalButton is AllInputButtons button) { Debug.Log($"Received input {button.ToString()}"); InputSender.Send(button); } else { var formattedMessage = $"{raw.controllerCommand} {raw.controllerValue}"; if (settings.LogDebugInfo) { Debug.Log($"Received message {formattedMessage}"); } Events.Instance.Raise(new InputUpdate(formattedMessage)); } }
static void Main() { var form = CreateWindow(); // Show info/instructions about this sample ShowInfo(); // Information about the available devices ListDevices(); // Setup the devices RegisterMouse(DeviceFlags.InputSink | DeviceFlags.DeviceNotify, form.Handle); RegisterKeyboard(DeviceFlags.None); WriteLine(); ShowRegisteredDevices(); form.FormClosed += (s, e) => isWindowVisible = false; // Check for input every 500ms do { Thread.Sleep(500); RawInput.ProcessMessages(); // This is only for the window to remain responsive and paint its contents Application.DoEvents(); }while (isWindowVisible); }
public static extern int GetRawInputData( IntPtr hRawInput, RawInputCommand command, out RawInput pData, ref int pcbSize, int cbSizeHeader );
public SelectDevicePopupWindow() { InitializeComponent(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _rawinput = new RawInput(Process.GetCurrentProcess().MainWindowHandle, CaptureOnlyInForeground); _rawinput.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled Win32.DeviceAudit(); DataTable table = new DataTable(); table.Columns.Add("DeviceType", typeof(string)); table.Columns.Add("DeviceName", typeof(string)); table.Columns.Add("etc", typeof(string)); Dictionary <IntPtr, KeyPressEvent> devices = RawInput.GetKeyboardDriver().GetDeviceList(); foreach (var item in devices.Keys) { if (Win32.GetDeviceType(devices[item].DeviceType) != DeviceType.RimTypekeyboard) { continue; } table.Rows.Add(new string[] { devices[item].DeviceType, devices[item].DeviceName, devices[item].ToString() }); } DeviceGrid.ItemsSource = table.DefaultView; }
static void Main() { var form = CreateWindow(); // Show info/instructions about this sample ShowInfo(); // Information about the available devices ListDevices(); // Setup the devices RegisterMouse(DeviceFlags.InputSink | DeviceFlags.DeviceNotify, form.Handle); RegisterKeyboard(DeviceFlags.None); WriteLine(); // Listen to device changes RawInput.DeviceChanged += OnDeviceChanged; ShowRegisteredDevices(); RawInput.StartProcessingMessages(form.Handle); Application.Run(form); RawInput.StopProcessingMessages(); }
public Multiplayer() { InitializeComponent(); //For Keyboard AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _rawinput = new RawInput(Handle, true); _rawinput.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled Win32.DeviceAudit(); // Writes a file DeviceAudit.txt to the current directory _rawinput.KeyPressed += OnKeyPressed; //Keyboard End wr = new WordsReader(); Timelimit.Start(); Gameflow.Start(); NextLevel(); /* * THREAD TEST * * */ }
public Decomision() { InitializeComponent(); var a = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(long.Parse("1595488622")).ToLocalTime(); timer1.Interval = 1000; timer2.Interval = 500; timer1.Start(); _rawinput = new RawInput(Handle, CaptureOnlyInForeground); isStart = false; cbProduct.DisplayMember = "Name"; cbProduct.ValueMember = "Value"; tbBatchnumber.Enabled = false; table.Columns.Add("GS1 ID"); table.Columns.Add("Status"); table.Columns.Add("Date"); table.Columns.Add("Time"); dataGridView4.DataSource = table; dataGridView4.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView4.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView4.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView4.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; table2.Columns.Add("GS1 ID"); table2.Columns.Add("Status"); table2.Columns.Add("Date"); table2.Columns.Add("Time"); dataGridView1.DataSource = table2; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; getProductName(); }
private void RegisterRawInputDevices() { int count = 1; int size = Marshal.SizeOf(typeof(RawInput.RAWINPUTDEVICE)); RawInput.RAWINPUTDEVICE[] devices = new RawInput.RAWINPUTDEVICE[count]; //for DS4 //devices[0].usUsagePage = 1; //devices[0].usUsage = 5;//Game Pad //devices[0].hwndTarget = this.Handle; //devices[0].dwFlags = (int)RawInput.RIDEV.INPUTSINK; //PSVR devices[0].usUsagePage = 0xFF01; devices[0].usUsage = 0x01;//VS devices[0].hwndTarget = this.Handle; devices[0].dwFlags = (int)RawInput.RIDEV.INPUTSINK; /* * raw_input_device [0].usUsagePage = 0x0D; * // RIDEV_PAGEONLY specifies all devices whose top level collection is from the specified usUsagePage. * // Note that usUsage must be zero.b * raw_input_device [0].dwFlags = RIDEV_INPUTSINK | RIDEV_PAGEONLY; * raw_input_device [0].usUsage = 0x00; * // route the RAWINPUT messages to our window; this is required for the RIDEV_INPUTSINK option * raw_input_device [0].hwndTarget = hwnd; */ RawInput.RegisterRawInputDevices(devices, (uint)devices.Length, (uint)size); }
private enum MusicKeys { Previous = 177, Next = 176, Stop = 178, PlayPause = 179, VolumeDown = 174, VolumeUp = 175 } // Key input numbers for expanded keyboards public frmKodiMediaKeys() { Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); // Catch specific errors AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); InitializeComponent(); _rawinput = new RawInput(Handle); _rawinput.CaptureOnlyIfTopMostWindow = false; // Setting that will determine whether to capture keys all the time or just when in focus _rawinput.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled _rawinput.KeyPressed += OnKeyPressed; //Win32.DeviceAudit(); // Writes a file DeviceAudit.txt to the current directory if (ProcessAlreadyRunning()) // Determines whether or not Kodi is currently running or not. { lDisplay.Initialize(niKodi_MediaKeys, pbLCD); // Initializes the keyboard eWatcher = WatchForProcessEnd(processToWatch); // Will exit the application when Kodi is exited. } else { sWatcher = WatchForProcessStart(processToWatch); // Will start the application when Kodi is started } EventLogSetup(); }
private static Dictionary <uint, Device> GetHyperXDevices() { var treeViewDevices = new TreeView(); RawInput.PopulateDeviceList(treeViewDevices); var devices = new Dictionary <uint, Device>(); foreach (TreeNode node in treeViewDevices.Nodes) { Device device = (Device)node.Tag; if (IsHyperXMuteInputDevice(device)) { if (devices.ContainsKey(device.UsageId)) { Debug.WriteLine("Similar device already registered!"); } else { devices.Add(device.UsageId, device); } } } return(devices); }
protected override void WndProc(ref Message m) { WM message = (WM)m.Msg; if (message == WM.INPUT) { RawInput.ProcessMessage(m.LParam); } else if (message == WM.NCHITTEST) { Point pos = new Point(m.LParam.ToInt32()); pos = PointToClient(pos); if (gripRect.Contains(pos)) { m.Result = (IntPtr)17; } else if (rightEdgeRect.Contains(pos)) { m.Result = (IntPtr)11; } else if (leftEdgeRect.Contains(pos)) { m.Result = (IntPtr)10; } return; } if (m.Msg == Program.WM_SHOWME) { Restore(); } base.WndProc(ref m); }
public frmAddBarCodeScanner() { InitializeComponent(); _rawinput = new RawInput(Handle, true); _rawinput.KeyPressed += OnKeyPressed; }
public FressianReader(Stream stream, org.fressian.handlers.ILookup <Object, ReadHandler> handlerLookup, bool validateAdler) { standardExtensionHandlers = Handlers.extendedReadHandlers; this.rawInput = new RawInput(stream, validateAdler); this.handlerLookup = handlerLookup; resetCaches(); }
private void Form1_MouseWheel(object sender, MouseEventArgs e) { if (e.Delta != 0) { if (RawInput.IsPressed(VirtualKeys.Control)) { centerPanel.Visualiser.IncreaseBarWidth(0.5f * e.Delta / SystemInformation.MouseWheelScrollDelta); } else if (RawInput.IsPressed(VirtualKeys.Menu)) { centerPanel.Visualiser.IncreaseResolution(e.Delta / SystemInformation.MouseWheelScrollDelta); } else { float delta = 0.05f; if (RawInput.IsPressed(VirtualKeys.Shift)) { delta = 0.01f; } float volumeChange = (e.Delta / (float)SystemInformation.MouseWheelScrollDelta) * delta; float newVol = player.AddVolume(volumeChange); if (newVol >= 0) { Settings.Set(Setting.Volume, newVol); Settings.WriteSettings(); SetVolumeLabel(newVol); } } } }
public void HookHotkeys() { Detach(); _hooks.Clear(); var config = _config.LoadConfiguration(); var settings = config.UserSettings.HotkeySettings; _rawinput = new RawInput(_mainWindowHandle); var kb = (RawKeyboard)_rawinput.CreateKeyboard(); _rawinput.AddDevice(kb); kb.RawKeyInputReceived += Keyboard_RawKeyboardInputReceived; _kb = kb; var mouse = (RawMouse)_rawinput.CreateMouse(); _rawinput.AddDevice(mouse); mouse.RawMouseInputReceived += Mouse_RawMouseInputReceived; _mouse = mouse; foreach (var hotkey in settings.Settings.Where(hotkey => hotkey.IsEnabled)) { RubberduckHotkey assigned; if (Enum.TryParse(hotkey.Name, out assigned)) { var command = Command(assigned); Debug.Assert(command != null); AddHook(new Hotkey(_mainWindowHandle, hotkey.ToString(), command)); } } Attach(); }
private RawInput ProcessRawInput(RawInput input, int outSize) { if (outSize != -1) { if (input.Header.Type == RawInputType.Keyboard) { if (Initializing) { var currentControl = currentForm.ActiveControl; controlByKeyboard[input.Header.Device] = currentControl; var initializationMessage = String.Format("{0} <- Keyboard[{1}]", currentControl.Name, input.Header.Device); MessageBox.Show(initializationMessage); } else { var msg = String.Format("[{0}] {1}", input.Header.Device, input.Data.Keyboard.VirtualKey.ToString()); if (controlByKeyboard.ContainsKey(input.Header.Device)) { Win32MinimalWrap.SendMessage(controlByKeyboard[input.Header.Device].Handle, (uint)WM.KEYDOWN, (IntPtr)input.Data.Keyboard.VirtualKey, IntPtr.Zero); } else { MessageBox.Show(msg); } } } } return(input); }
public void OneNull_False() { var comparer = new RawInputEqualityComparer(); var firstInput = new RawInput("Test", EInputType.Analog); Assert.IsFalse(comparer.Equals(firstInput, null)); }
public void Initialize() { RawInput rawinput = new RawInput(Terraria.Main.instance.Window.Handle, false); rawinput.KeyPressed += OnKeyPressed; Events.PreUpdate += OnUpdate; Events.QuitGame += delegate { DetachKeyboard(); }; }
public void SameObject_True() { var comparer = new RawInputEqualityComparer(); var firstInput = new RawInput("Test", EInputType.Analog); var secondInput = firstInput; Assert.IsTrue(comparer.Equals(firstInput, secondInput)); }
public Vector2 GetThrottledFirst() { if (_queue.Count > 0 && _queue[0].Phase == TouchPhase.Began) { _currentBegin = _queue[0]; } return(_currentBegin.Position); }
public static void Hook(Visual visual) { if (_rawInput == null) { _rawInput = new RawPresentationInput(visual, RawInputCaptureMode.ForegroundAndBackground); _rawInput.KeyPressed += RawInputOnKeyPressed; } }
public void Start() { var windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; _rawInput = new RawInput(windowHandle); _rawInput.KeyEvent += _rawInput_KeyEvent; _rawInput.MouseEvent += _rawInput_MouseEvent; }
public MainForm() { InitializeComponent(); contextMenu1.MenuItems.Add(new MenuItem("LISTEN.moe Desktop Client v" + Globals.VERSION.ToString()) { Enabled = false }); Settings.LoadSettings(); //Write immediately after loading to flush any new default settings Settings.WriteSettings(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); RawInput.RegisterDevice(HIDUsagePage.Generic, HIDUsage.Keyboard, RawInputDeviceFlags.InputSink, this.Handle); cts = new CancellationTokenSource(); ct = cts.Token; #pragma warning disable CS4014 CheckForUpdates(new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext())); #pragma warning restore CS4014 StartUpdateAutochecker(); this.MouseWheel += Form1_MouseWheel; this.Icon = Properties.Resources.icon; lblAlbum.Bounds = new Rectangle(58, 26, 321, 22); lblTitle.Bounds = new Rectangle(56, 5, 321, 43); lblTitle.Text = "Connecting..."; notifyIcon1.ContextMenu = contextMenu2; notifyIcon1.Icon = Properties.Resources.icon; favSprite = SpriteLoader.LoadFavSprite(); fadedFavSprite = SpriteLoader.LoadFadedFavSprite(); picFavourite.Image = favSprite.Frames[0]; RawInput.RegisterCallback(VirtualKeys.MediaPlayPause, async() => { await TogglePlayback(); }); Connect(); player = new WebStreamPlayer("https://listen.moe/stream"); player.SetVisualiser(visualiser); player.Play(); renderLoop = Task.Run(() => { while (!ct.IsCancellationRequested) { this.Invalidate(); Thread.Sleep(33); } }); ReloadScale(); ReloadSettings(); }
/// <summary> /// constructor /// </summary> public Keyboard() { InitializeComponent(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _rawinput = new RawInput(Handle, CaptureOnlyInForeground); _rawinput.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled Win32.DeviceAudit(); // Writes a file DeviceAudit.txt to the current directory _rawinput.KeyPressed += OnKeyPressed; }
/// <summary> /// Initializes a new instance of the <see cref="KeyboardInputEventArgs"/> class. /// </summary> /// <param name="rawInput">The raw input.</param> internal KeyboardInputEventArgs(ref RawInput rawInput) : base(ref rawInput) { Key = (Keys) rawInput.Data.Keyboard.VKey; MakeCode = rawInput.Data.Keyboard.MakeCode; ScanCodeFlags = rawInput.Data.Keyboard.Flags; State = rawInput.Data.Keyboard.Message; ExtraInformation = rawInput.Data.Keyboard.ExtraInformation; }
/// <summary> /// Initializes a new instance of the <see cref="HidInputEventArgs"/> class. /// </summary> /// <param name="rawInput">The raw input.</param> /// <param name="hwnd">The handle of the window that received the RawInput mesage.</param> internal HidInputEventArgs(ref RawInput rawInput, IntPtr hwnd) : base(ref rawInput, hwnd) { Count = rawInput.Data.Hid.Count; DataSize = rawInput.Data.Hid.SizeHid; RawData = new byte[Count * DataSize]; unsafe { if (RawData.Length > 0) fixed (void* __to = RawData) fixed (void* __from = &rawInput.Data.Hid.RawData) SharpDX.Utilities.CopyMemory((IntPtr)__to, (IntPtr)__from, RawData.Length *sizeof(byte)); } }
protected override void WndProc(ref Message m) { WM message = (WM)m.Msg; if (message == WM.INPUT) { RawInput.ProcessMessage(m.LParam); } base.WndProc(ref m); }
public void GetHashCode_ReturnsNamePlusType() { var comparer = new RawInputEqualityComparer(); const string inputName = "TestName"; const EInputType inputType = EInputType.Analog; var firstInput = new RawInput(inputName, inputType); Assert.AreEqual(inputName.GetHashCode() + inputType.GetHashCode(), comparer.GetHashCode(firstInput)); }
/// <summary> /// Initializes a new instance of the <see cref="MouseInputEventArgs"/> class. /// </summary> /// <param name="rawInput">The raw input.</param> internal MouseInputEventArgs(ref RawInput rawInput) : base(ref rawInput) { Mode = (MouseMode) rawInput.Data.Mouse.Flags; ButtonFlags = (MouseButtonFlags)rawInput.Data.Mouse.ButtonsData.ButtonFlags; WheelDelta = rawInput.Data.Mouse.ButtonsData.ButtonData; Buttons = rawInput.Data.Mouse.RawButtons; X = rawInput.Data.Mouse.LastX; Y = rawInput.Data.Mouse.LastY; ExtraInformation = rawInput.Data.Mouse.ExtraInformation; }
public static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient, IntPtr notificationFilter, RawInput.DeviceNotification flags);
private void exitToolStripMenuItem_Click(object sender, EventArgs e) { isstopped = true; input = null; Application.Exit(); }
internal RawInputEventArgs(ref RawInput rawInput) { Device = rawInput.Header.Device; }
internal RawInputEventArgs(ref RawInput rawInput, IntPtr hwnd) { Device = rawInput.Header.Device; WindowHandle = hwnd; }
private void InitializationSniffer(bool iscmd = false) { this.Visible = false; if (!iscmd) AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException; input = new RawInput(Handle); if (!iscmd) input.AddMessageFilter(); // Adding a message filter will cause keypresses to be handled if (!iscmd) input.KeyPressed += OnKeyPressed; this.CollectionHidDeviceInfo = input.CollectionHidDeviceInfo; if (!iscmd) notifyIcon1.Icon = (System.Drawing.Icon)resources.GetObject("Connected"); if (!iscmd) notifyIcon1.ShowBalloonTip(1, "Connected", "Start scanning.", ToolTipIcon.Info); }
public static extern int GetRawInputData(IntPtr hRawInput, RawInput.DataCommand command, [Out] out RawInput.RawInputData buffer, [In, Out] ref int size, int cbSizeHeader);
public static extern int GetRawInputData(IntPtr hRawInput, RawInput.DataCommand command, [Out] IntPtr pData, [In, Out] ref int size, int sizeHeader);
/// <summary>Performs a buffered read of the raw input data.</summary> /// <returns></returns> /// <exception cref="Win32Exception"/> internal static RawInput[] GetRawInputBuffer() { var headerSize = Marshal.SizeOf( typeof( RawInputHeader ) ); var size = 0; var result = GetRawInputBuffer( null, ref size, headerSize ); if( result == -1 ) throw new Win32Exception( "Failed to retrieve raw input buffer size.", GetExceptionForLastWin32Error() ); var count = size / Marshal.SizeOf( typeof( RawInput ) ); var buffer = new RawInput[ count ]; result = GetRawInputBuffer( buffer, ref size, headerSize ); if( result == -1 ) throw new Win32Exception( "Failed to retrieve raw input buffer.", GetExceptionForLastWin32Error() ); return buffer; }
public static extern uint GetRawInputDeviceInfo(IntPtr hDevice, RawInput.RawInputDeviceInfo command, IntPtr pData, ref uint size);
public static extern uint GetRawInputDeviceInfo(IntPtr hDevice, uint command, ref RawInput.DeviceInfo data, ref uint dataSize);
//UINT WINAPI GetRawInputData( // _In_ HRAWINPUT hRawInput, // _In_ UINT uiCommand, // _Out_opt_ LPVOID pData, // _Inout_ PUINT pcbSize, // _In_ UINT cbSizeHeader //); /// <summary>Returns the raw input from the specified device.</summary> /// <param name="rawInputHandle">A handle to the <see cref="RawInput"/> structure. This comes from the LParam in WM_INPUT.</param> /// <param name="rawInput"></param> /// <exception cref="Win32Exception"/> /// <exception cref="InvalidDataException"/> internal static void GetRawInputData( IntPtr rawInputHandle, out RawInput rawInput ) { var headerSize = Marshal.SizeOf( typeof( RawInputHeader ) ); var size = Marshal.SizeOf( typeof( RawInput ) ); var result = GetRawInputData( rawInputHandle, GetDataCommand.Input, out rawInput, ref size, headerSize ); if( result == -1 ) throw new Win32Exception( "Failed to retrieve raw input data.", GetExceptionForLastWin32Error() ); }
public static extern bool RegisterRawInputDevices(RawInput.RawInputDevice[] pRawInputDevice, uint numberDevices, uint size);
public Form1() { InitializeComponent(); rawInput = new RawInput(Handle); rawInput.AddMessageFilter(); rawInput.Keyboard.DevicesChanged += Keyboards_DevicesChanged; rawInput.Keyboard.EnumerateDevices(); }