0

If I have two keyboards connected to my PC and I subscribe to the keydown event of a control lets say a TextBox, is there any way in C# to identify which one of the keyboards caused the event?

Sameed
  • 655
  • 1
  • 5
  • 18
  • Yes, put the camera on each keyboard. Just kidding. This question is not belong to SO. – SᴇM Aug 29 '17 at 11:41
  • 3
    @SeM How does it not belong here? It's totally on topic. – Izuka Aug 29 '17 at 11:42
  • 2
    @Isuka do you see any code here? Or may be c# related question? – SᴇM Aug 29 '17 at 11:43
  • @SeM , you can see I have mentioned usercontrol and keydown event in my question, these terms are used in WPF I guess. – Sameed Aug 29 '17 at 11:46
  • @Sameed anyway, [This](https://stackoverflow.com/questions/587840/how-to-distinguish-between-multiple-input-devices-in-c-sharp/589326#589326) article may help you, maybe will solve your problem, maybe will give you an idea how to ask your question fully. Cheers. – SᴇM Aug 29 '17 at 11:46
  • @SeM , tthis answer complicates things and it is focused towards a Barcode scanner. – Sameed Aug 29 '17 at 11:49
  • 1
    The link in the answer linked to by SeM is broken but it does give you an idea of where to start looking if you put in the effort. It suggests the use of the Raw Input API - if you try googling "Raw Input API two keyboards" you will find links like these https://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard & https://www.codeproject.com/Articles/716591/Combining-Raw-Input-and-keyboard-Hook-to-selective - they may give you some idea of how to achieve what you want. Without showing what efforts you have put in so far you are unlikely to get much help. – PaulF Aug 29 '17 at 12:12

0 Answers0