views:

302

answers:

1

I created a simple test with SendKeys, and tried both SendWait and Send.

 Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
    System.Threading.Thread.Sleep(10000)
    SendKeys.SendWait("If you can read this, it works." + "{ENTER}")
End Sub

I tested in skype, and a few of the letters doubled. I tested in Flash, I got "Iffff yyouu cccaaaannn rrreaaaddd thhhiiisss,,, iiittt wwwooorrrrkkks."

Clearly the issue is caused by lag. What can I do to prevent doubling (or tripling) of letters? I'm probably missing something big here...

+2  A: 

In your app settings, try

<appSettings>

<add key="SendKeys" value="SendInput"/>

</appSettings> 

If that doesn't work, try:

<appSettings>

<add key="SendKeys" value="JournalHook"/>

</appSettings> 

Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.sendwait.aspx

"... As a result, the SendKeys class may behave differently on different operating systems ..."

hamlin11
I'm sorry, where exactly is my "app settings"? This is a winforms app, not WPF, and I see no files which would accept XML. Thanks for the tip though, I will give it a try when I find "app.config"
Cyclone
Got it working! Thanks!
Cyclone
In Visual Studio, right click your project and go to settings. Then go to the settings tab. Then you should be able to add it there. It saves these in an app.config file where you can add your modifications via a text editor.
hamlin11