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:
stupid-phil
2010-05-16 08:14:13
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
2010-05-16 10:58:24
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
2010-05-16 15:55:25
I tried the application in the given project but I I get the some results (keys are not sent)
Guy
2010-05-16 13:46:54