本文介绍了Vb.net sendkeys,字母重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SendKeys 创建了一个简单的测试,并尝试了 SendWait 和 Send.

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

我在 Skype 中测试过,有几个字母翻了一番.我在 Flash 中测试,我得到Iffff yyouu cccaaaannn rrreaaaddd thhhiiisss,,, iiittt wwwooorrrrkkks."

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...

推荐答案

在你的应用设置中(app.config 在 Visual Studio 解决方案中,或 .exe.config 当与应用程序并排放置时),将以下内容添加为 元素的子元素:

In your app settings (app.config in a Visual Studio solution, or <myapp>.exe.config when located side by side to the application), add the following as child of the <configuration> element:

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

如果这不起作用,请尝试:

If that doesn't work, try:

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

来源:SendWait() [MSDN]

"... 结果,SendKeys 类可能在不同的情况下表现不同操作系统..."

这篇关于Vb.net sendkeys,字母重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 04:30