Using VisualStudio.NET, I’d like to create a program that generates keystroke events for another program that consumes them. (The idea is to be able to test the second program without actually having to sit at a keyboard and press keys.)
I can’t think of anything specific in .NET that would do what you want, but you can write either a Keyboard hook or Journal playback hook.
There is a great book that has a few chapters devoted to this called Windows 95 A developer’s Guide buy Jeffrey Richter and Jonathan Locke. Chapters 6 and 8 talk about the various ways you could achieve what you want to do and why he chose to solve the problem the way he did. Don’t worry that was written for Windows 95, the concepts are still the same. The book is probably out of print, but you can likely get a used copy off of Amazon