I'm actually trying to do this on a Raspberry Pi right now to emulate a HDI. There are a lot of existing libraries that do this. I needed to do this because the native SendMessage/PostMessage ways to send keystrokes to a Windows process break down when you need to send modifier keys -- I needed to send ":" but I could only send ";". I tried endlessly to send the "shift" modifier key to no avail.
I actually considered directly writing to memory to "trick" the program to think certain keys are pressed (but this doesn't work for emulating actual typing input), or hook into functions with a dll injection and interleave fake input somehow.
I actually considered directly writing to memory to "trick" the program to think certain keys are pressed (but this doesn't work for emulating actual typing input), or hook into functions with a dll injection and interleave fake input somehow.