Make another program think I'm holding down the spacebar for a second

134 views Asked by At

I'm trying to write a program that brings another program to the front and hold down the spacebar for a second.

I've researched all sorts of SendMessage, PostMessage, SentInput, etc ... and none of them seem to work, or else I'm just doing it wrong.

Anyone have a sure-fire method of sending keyboard input? Thanks.

1

There are 1 answers

1
Greg the Incredulous On

You could try using the SendKeys class - see here: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys%28v=vs.110%29.aspx

If that doesn't do what you need then you could also try this: how to perform a hold ALT+TAB sendkey event in C# which gives advice on how to hold a key down.