none
Different keyboards – different inputs, how to talk to hardware through .NET framework? RRS feed

  • Question

  • Different keyboards – different inputs, how to talk to hardware through .NET framework?

    Greetings community,

    This problem is part of laboratory setup that we are about to create. To keep long story short, for some security reason, one of those requirements is to have separate numeric keyboard for the app. This app should do something like this:

    1. If you press key 7 on numeric pad of main keyboard, character “7” appears in the textbox that has a focus, just like everyone would expect
    2. If you press key 7 on the remote (wireless) through USB attached numeric pad, some other process starts, regardless of what part of app’s UI has got the focus.

    Idea is that operators, regardless of their level of security, cannot start several “high risk” processes accidentally, but only if they deliberately move ten feet away from the desk, and press button on the separate keyboard.

    I bought one of those “for laptop” numeric pad, plugged it in my computer, and it installed itself. Now, in “devices and printers” I have two “HID keyboard device”. Manufacturer didn’t bother too much, both have Microsoft native drivers, and only property that has any meaning on first inspection is “Device instance path”

    So, my question is: How to make .NET app that can recognize which keyboard has given the input signal? I don’t expect you to do that for me of course, but point me where to start looking in documentation. I don’t have idea at all.

    Thanks in advance

    Thursday, September 17, 2020 3:21 PM

Answers

  • Hi IvicaNesic,

    It seems that the best solution is the solution in Using Raw Input from C# to handle multiple keyboards

    There is not a better solution to implement the function with .net  framework, so you can consider clicking the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue. Thanks.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, September 22, 2020 5:49 AM
    Moderator
  • I cannot test as I have only 1 keyboard, but it should work with Raw Input 

    You can find articles on Google, like

    Using Raw Input from C# to handle multiple keyboards 


    Thursday, September 17, 2020 3:33 PM
  • Don't get me wrong. I've had been doing this kind of WM_LETMEIN things long time ago, but I hoped that .NET got some abilities after so many years. I hoped to be able to create an app that would depend on OS to decide work or not, depending on who was logged in for example.

    Anyway, thanks for your time again.

    Well, using DotNET you actually can determine what user is logged into the system, what groups they belong to, what permissions they have for a specific directory or file, etc and immediately exit an app if you don't like them.  That's absolutely NOT what you asked.

    You asked how to accomplish some low level hardware fu and then disparaged DotNET Framework for not being able to do something else that's relatively trivial in DotNET.

    What's your game here?  You seriously trolling, or just that stoned?


    Before you can learn anything new you have to learn that there's stuff you don't know.


    • Edited by Andrew B. Painter Thursday, September 17, 2020 7:03 PM
    • Marked as answer by IvicaNesic Wednesday, September 23, 2020 6:40 PM
    Thursday, September 17, 2020 7:02 PM

All replies

  • I cannot test as I have only 1 keyboard, but it should work with Raw Input 

    You can find articles on Google, like

    Using Raw Input from C# to handle multiple keyboards 


    Thursday, September 17, 2020 3:33 PM
  • Hello Castorix31,

    Thanks for taking the time and for your reply.

    However, I hoped for .NET managed solution, not for some 32-bit low level "you might be a hacker" solution.

    Don't get me wrong. I've had been doing this kind of WM_LETMEIN things long time ago, but I hoped that .NET got some abilities after so many years. I hoped to be able to create an app that would depend on OS to decide work or not, depending on who was logged in for example.

    Anyway, thanks for your time again.

    Thursday, September 17, 2020 4:05 PM
  • Don't get me wrong. I've had been doing this kind of WM_LETMEIN things long time ago, but I hoped that .NET got some abilities after so many years. I hoped to be able to create an app that would depend on OS to decide work or not, depending on who was logged in for example.

    Anyway, thanks for your time again.

    Well, using DotNET you actually can determine what user is logged into the system, what groups they belong to, what permissions they have for a specific directory or file, etc and immediately exit an app if you don't like them.  That's absolutely NOT what you asked.

    You asked how to accomplish some low level hardware fu and then disparaged DotNET Framework for not being able to do something else that's relatively trivial in DotNET.

    What's your game here?  You seriously trolling, or just that stoned?


    Before you can learn anything new you have to learn that there's stuff you don't know.


    • Edited by Andrew B. Painter Thursday, September 17, 2020 7:03 PM
    • Marked as answer by IvicaNesic Wednesday, September 23, 2020 6:40 PM
    Thursday, September 17, 2020 7:02 PM
  • Hi Andrew,

    I’m not native English speaker, so it must be my insufficient knowledge of English to blame.

    Here are my apologies.

    I’m sorry for not being clear enough in the title as well as in last paragraph that I wanted .NET solution.

    I’m sorry for being so sick and perverted to publicly express hope that after all these years is natural to expect .NET coverage with comfort of intellisense for something so basic as pressing buttons on the second keyboard.

    My first PC had 32 megabytes capacity hard drive, and my current PC came with 1T on primary SSD. I’m sorry for not realizing that reading keyboards is still “low level hardware fu”, whatever that means.

    I’m sorry for whatever had happened to you, and put you in so bad mood to make you able to say to someone that they are either trolling or simply stoned only because they hoped for something.

    But Andrew, close your eyes, take a deep breath, and count to ten, while I ask some of the moderators here to confirm your opinion that .NET is still uncapable to undertake this particular problem, so we can mark your reply as an answer, and be grateful for your “taking the part”.

    Thursday, September 17, 2020 9:02 PM
  • Hi Andrew,

    I’m not native English speaker, so it must be my insufficient knowledge of English to blame.

    BOY IS MY FACE RED!!! Especially after I've been putting "Psychic certified by Hogwartz Academy" on my resume all these years, it's just horrible that I failed to read your mind.

    Here are my apologies.

    I’m sorry for not being clear enough in the title as well as in last paragraph that I wanted .NET solution.

    I’m sorry for being so sick and perverted to publicly express hope that after all these years is natural to expect .NET coverage with comfort of intellisense for something so basic as pressing buttons on the second keyboard.

    If it's any consolation, a couple of years back I started working on a Python-based CGI for Apache without realizing that AFTER ALL THESE YEARS Python's templating is still worse than a bad joke. Just as you will go crawling back to WinAPI begging her to take you back, I went crawling back to PHP, hat in hand, asking for another chance!

    My first PC had 32 megabytes capacity hard drive, and my current PC came with 1T on primary SSD. I’m sorry for not realizing that reading keyboards is still “low level hardware fu”, whatever that means.

    ROFLMAO. You think you're experienced. My first PC had no HDD and a 768kb floppy disk drive, which happened to be the same amount of RAM that was in it. Until modems quit being a thing, I was able to identify incoming baudrates and even handshake options based on audible tones.

    "Kung Fu" is a highly respected martial art. Adding "Fu" to the end of anything indicates a high level of talent, skill, and experience in whatever the preceding bit is. eg Hardware Fu in reference to low-level programming to identify one keyboard from another by incoming keystrokes.

    What's especially funny, in your case, is your statement that you're this 1337 from back in the day (and you evidently think "the day" was post-2000) and you literally made reference to WM_LETMEIN, indicating that you know anything at all about Windows programming... yet you're here whining loudly about how much DotNET sucks because you don't know how to override WndProc and test incoming scan codes to identify the device that sent them. Bum-BADUNK!

    I’m sorry for whatever had happened to you, and put you in so bad mood to make you able to say to someone that they are either trolling or simply stoned only because they hoped for something.

    You're right. I should have been guessing at how many years old you are less than 9, as your ongoing titty fitty and noxious disinformation about your haxx0rzz1n6 background grows louder and dumber.

    But Andrew, close your eyes, take a deep breath, and count to ten, while I ask some of the moderators here to confirm your opinion that .NET is still uncapable to undertake this particular problem, so we can mark your reply as an answer, and be grateful for your “taking the part”.

    I have a prescription for Ativan. Let's get to the point: Go smoke another joint and then head on down the road!


    Before you can learn anything new you have to learn that there's stuff you don't know.

    Thursday, September 17, 2020 9:34 PM
  • Hi Andrew,

    Go consume your prescription. Unfortunately, I cannot join you, I have some experience with smoking. Very nasty and extremely addictive habit. Had hard time stoping using nicotine, and can tell you never again.

    Better let forums moderators clean up after us, and let me know what to think about matter in hand.

    Thursday, September 17, 2020 10:37 PM
  • Hi Andrew,

    Go consume your prescription. Unfortunately, I cannot join you, I have some experience with smoking. Very nasty and extremely addictive habit. Had hard time stoping using nicotine, and can tell you never again.

    Better let forums moderators clean up after us, and let me know what to think about matter in hand.


    ... yet you're here whining loudly about how much DotNET sucks because you don't know how to override WndProc and test incoming scan codes to identify the device that sent them. Bum-BADUNK!

    For the 2nd time, now in bold-face print.


    Before you can learn anything new you have to learn that there's stuff you don't know.



    Before you can learn anything new you have to learn that there's stuff you don't know.

    Friday, September 18, 2020 5:11 PM
  • Hi Andrew,

    You have been missing the point all the time. You called me troll, but when it came to saying something useful, you failed like any decent troll would. If you were half old, as you’ve claimed to be, you’d know how sad your behavior is. I mean, if you’re really 50-60 years old, and you think that insulting (stupid) people is ok, then you must have been staying at home all those years, pressing buttons on your keyboard, not having a life at all, while people outside make love or wars with each other. Come on, you don’t have anything to prove to me. Putting me low, will not help you high, it’s just an illusion created by relative position. How you managed to pass the age of 40 years old, and not learning this simple fact, really escapes me. However, don’t change your life style now, stay at your desk, there’s a virus raging outside.

    Anyhow, if you have a MSDN link to “override WndProc and test incoming scan codes to identify the device that sent them”, do tell. Otherwise, let moderators clean up the mess.

    • Proposed as answer by Mattia Fanti Tuesday, September 22, 2020 9:11 PM
    Monday, September 21, 2020 12:30 AM
  • Hi IvicaNesic,

    It seems that the best solution is the solution in Using Raw Input from C# to handle multiple keyboards

    There is not a better solution to implement the function with .net  framework, so you can consider clicking the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue. Thanks.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, September 22, 2020 5:49 AM
    Moderator
  • Hi Andrew,

    You have been missing the point all the time. You called me troll, but when it came to saying something useful, you failed like any decent troll would. If you were half old, as you’ve claimed to be, you’d know how sad your behavior is. I mean, if you’re really 50-60 years old, and you think that insulting (stupid) people is ok, then you must have been staying at home all those years, pressing buttons on your keyboard, not having a life at all, while people outside make love or wars with each other. Come on, you don’t have anything to prove to me. Putting me low, will not help you high, it’s just an illusion created by relative position. How you managed to pass the age of 40 years old, and not learning this simple fact, really escapes me. However, don’t change your life style now, stay at your desk, there’s a virus raging outside.

    Anyhow, if you have a MSDN link to “override WndProc and test incoming scan codes to identify the device that sent them”, do tell. Otherwise, let moderators clean up the mess.

    I love how you paint yourself as a victim and portray me as just this Gollem-esque character, leaping unbidden from the shadows, where I called you Gollem outright and drew my sword (dipped liberally in the inkwell) and wrote angrily at you for being so unbelievably arrogant to people who you're asking for help.  The drama continues!

    Before you can learn anything new you have to learn that there's stuff you don't know.

    Tuesday, September 22, 2020 1:15 PM
  • Hi Xingyu Zhao,

    Thanks for ending this. Let's hope for different answer to the same question in few years.

    Wednesday, September 23, 2020 6:43 PM