在WPF应用程序SendKeys.Send方法 [英] SendKeys.Send Method in WPF application

查看:1883
本文介绍了在WPF应用程序SendKeys.Send方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要发送按键(按Ctrl + T)的浏览器控件。但是, SendKeys.Send()显示在WPF应用程序错误?我的问题是

I'm trying to send Keystroke(Ctrl+T) for browser control. But, SendKeys.Send() showed error in WPF application?? My question is

1)在WPF应用程序可以我用这个方法?

1) Can I use this method in WPF application?

2)是否有其他方法来回回发送自动按键。

2) Is there any alternative method fro sending automatic keystroke.

感谢。

推荐答案

的SendKeys是System.Windows.Forms命名空间的一部分,没有在WPF等效方法。你不能使用SendKeys.Send使用WPF,但你可以使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.sendwait.aspx">SendKeys.SendWait方法,如果您添加System.Windows.Forms的到你的项目引用。你唯一的选择是向PInvoke的 SendInput

SendKeys is part of the System.Windows.Forms Namespace there is not an equivalent method in Wpf. You can not use the SendKeys.Send with WPF but you can use the SendKeys.SendWait method, if you add System.Windows.Forms to your project references. Your only other option would be to to PInvoke SendInput.

请注意,这两种方法将数据发送到当前活动窗口。

Be aware that both of these methods send data to the currently active window.

这篇关于在WPF应用程序SendKeys.Send方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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