Distinguish between keystrokes Real and Virtual Key

I am writing a C # program that should simulate keyboard keystroke commands.

The problem is that I need to simulate "realistic" keystrokes on the keyboard, not fake ones. For example, as I understand it:

  • when the user presses any button on the keyboard - the signal is sent via USB, and then goes through the keyboard driver.

  • when APIs are used (SendInput, SendKeys, KeyBoardEvent or something else) - we bypass USB and the driver, so basically these types of presses can be tracked using the global hook method.

How to simulate realistic keystrokes?

  • I have no knowledge in C ++, so writing my own driver is not an option.

  • I do not mind the use of microcontrollers or any additional hardware "solutions" if it is cheap.

  • Is it possible to connect two PCs via a USB cable to send a realistic button on the keyboard from PC2 to PC1?

and what method?

0
source share
1 answer

You can identify the keyboard event dispatched using SendInput () using the global keyboard (WH_KEYBOARD_LL). The LowLevelKeyboardProc callback method returns KBDLLHOOKSTRUCT as a parameter.

If the LLKHF_INJECTED flag is set to KBDLLHOOKSTRUCT.flags, SendInput () was added to the keyboard event.

+2
source

All Articles