Looking for directions in emulating keyboard presses on the hardware level

Apologies if this is the wrong subreddit.

I’m working on a project that requires hardware emulation of keyboard presses.

I’m afraid simulating at the software level does not cut it, as the program for which I’m trying to pass fake keyboard strokes is doing a damn good job at preventing me from doing so.

I tried a bunch of different Python libraries, but all failed to deliver, this includes using Pynput and keyboard libraries. Of course everything work outside of the software that I need.

After failing with Python, I tried C++ and the SendInput function from User32.dll, something along the lines of:

#include <Windows.h> void SimulateKeyPress(WORD virtualKeyCode) { INPUT input; ZeroMemory(&input, sizeof(INPUT)); input.type = INPUT_KEYBOARD; input.ki.wVk = virtualKeyCode; input.ki.dwFlags = 0; // No additional flags for key press SendInput(1, &input, sizeof(INPUT)); } 

Once again, this work everywhere, BUT in the software that I need.

So, I came to ask the specialists in this field, how do I go about emulating keyboard presses as if they were coming from an actual hardware? Is this possible to emulate with some low-level programming, or would I have to get a micro controller and go that route?

Any advice is most welcome.

submitted by /u/FriendlyRussian666
[link] [comments]

May 19, 2023
Read More >>