SendKeys.send被阻止 [英] SendKeys.send is blocked

查看:155
本文介绍了SendKeys.send被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Sendkeys.send将文本发送到其他应用程序的C#应用​​程序。
一段时间后在Windows 7上执行时,Sendkeys停止响应并且不发送任何文本。在Windows XP上永远不会发生。
我怀疑有反病毒,但是当我没有反病毒运行时也会发生。
有什么想法可以引起它吗?
谢谢您的帮助。

I have C# application that uses Sendkeys.send to send text to other applications. When executed on windows 7 after some time the Sendkeys stop responding and doesn't send any text. It never happens on windows XP. I suspected the anti virus but it happen also when I'm running with no anti virus. Any ideas what can cause it? Thank you for your help.

推荐答案

您要针对哪个版本的.NET Framework进行编译? 如果您仍在使用2.0之前的版本,则最有可能由于UAC增强的安全模型而在Windows 7中遇到兼容性问题。

What version of the .NET Framework are you compiling against? If you're still using a version prior to 2.0, you are most likely experiencing compatibility problems in Windows 7 as a result of UAC's enhanced security model.

SendKeys.Send 方法在Framework的3.0版中已更新,可以与Windows Vista及更高版本正常使用。请参阅文档

The SendKeys.Send method was updated in version 3.0 of the Framework to work properly with Windows Vista and newer. See the documentation:


.NET Framework 3.0的SendKeys类已更新,可以在Windows Vista上运行的应用程序中使用。 Windows Vista的增强的安全性(称为用户帐户控制或UAC)使以前的实现无法按预期工作。

The SendKeys class has been updated for the .NET Framework 3.0 to enable its use in applications that run on Windows Vista. The enhanced security of Windows Vista (known as User Account Control or UAC) prevents the previous implementation from working as expected.

升级; Windows 7已包含3.5版。

You need to upgrade; version 3.5 is already included with Windows 7.

否则,P /调用 SendMessage 函数。检查 pinvoke.net 中的声明,您需要使用C#进行调用。

Otherwise, P/Invoking the SendMessage function exposed by the Windows API is an option if you need to send data to other applications. Check pinvoke.net for the declaration you'll need to call this in C#.

这篇关于SendKeys.send被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆