0

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.

Jonathan Plumb
  • 417
  • 1
  • 4
  • 12

1 Answers1

1

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.

Community
  • 1
  • 1
Greg the Incredulous
  • 1,676
  • 4
  • 29
  • 42
  • @Jonathan if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Greg the Incredulous Nov 28 '14 at 05:19