Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SendKeys.SendWait doesn't work in some cases

My target is to send keyboard events to external application. From my application, I'm launching a C# console application that bring the target application to the front and uses SendKeys.SendWait to send keyboards events. I ran into a rate case where the command doesn'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.

like image 931
Guy Avatar asked Jun 27 '26 03:06

Guy


1 Answers

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

like image 124
philiphobgen Avatar answered Jun 29 '26 16:06

philiphobgen