tags:

views:

268

answers:

2

My target is to send keyboard events to external application. From my application, I'm launching a C# exe (console application) that bring the target application to the front and uses SendKeys.SendWait to send keyboards events. I ran into a rate case were the command don't have any affect. When debugging it, it works but when running it not in debug it fails. I think it as something to do with the fact that when debugging my application is the active application.

+1  A: 

You'll need to do a little work, and it changes depending on the version of Windows. There's an MSDN page that has a good explanation and an example:

http://msdn.microsoft.com/en-us/library/ms171548.aspx

stupid-phil
Thanks for the link.I don't understand what should I do I'm using sendWait run with .NET Framework 3.0 and experiencing the problem.
Guy
Read everything on that page from "Simulating Keyboard Input" down. There's a section titled "To send a keystroke to a different application" it shows an example of sending key to another application using sendWait. You need to read it all though, as it points out issues that you might get.
stupid-phil
A: 

Check this http://www.codeproject.com/KB/cs/SendKeys.aspx

Space Cracker
I tried the application in the given project but I I get the some results (keys are not sent)
Guy