SendKeys.SendWait doesn't works
10,184
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
Author by
Guy
Updated on June 27, 2022Comments
-
Guy almost 2 years
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.
-
Guy about 14 yearsThanks 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.
-
philiphobgen about 14 yearsRead 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.
-
Abhishek over 6 yearsLike stated in the answer, it also depends upon the version of .NET framework being used. It worked for me on .NET 4.5 but didn't work on .NET 4.5.3.