如何将密钥发送到另一个应用程序 [英] How to send keys to another application

查看:92
本文介绍了如何将密钥发送到另一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友.

我是VB.Net程序员.
我想知道如何将密钥发送到另一个具有文本框和按钮或任何其他控件的应用程序.

等待响应.

Dear Friends.

I am a VB.Net programmer.
I want to know that How can I send keys to another application which has textboxes and buttons or any other controls.

Waiting for response.

推荐答案

您可以使用以下代码:

System.Windows.Forms.SendKeys.Send("...")

将...替换为您要发送的密钥.

http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx [ ^ ]

祝你好运!

ps.必须激活另一种形式才能接收您发送的那些密钥.焦点突出的控件将获取这些键.
You could use the following:

System.Windows.Forms.SendKeys.Send("...")

Replace the ... by the key you want to send.

http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx[^]

Good luck!

ps. The other form must be activated in order to receive those keys you send. The focussed control will get these keys.





首先激活另一个应用程序
然后使用like,

System.Windows.Forms.SendKeys.Send("{TAB}");


如果有帮助,请回复,

谢谢
Vaibhav J
Hi,


First Activate your another application
and then use like,

System.Windows.Forms.SendKeys.Send("{TAB}");


Please reply if helpful,

Thanks
Vaibhav J


兄弟.
感谢您的回答.
但是我已经应用了您给定的代码,但是没有找到任何结果.您说过按键将进入主动控制状态,但是我打开了记事本并将光标放在记事本中,但是当我单击必须实现上述给定代码的程序按钮时,焦点便从记事本中丢失了,转到我的应用程序按钮.然后在我的应用程序处于焦点状态时如何获得另一个控件的焦点.
Brothers.
Thanks for answering.
But I have applied your given code, but did not found any result. You said that the keys will be gone to active control but I opened the notepad and put the cursor in note pad but when i clicked on the button of my program which has to implement the above your given code the focus was lost from the notepad and goes to my application button. Then how it is possible to get focus of an other control while my application is in focus.


这篇关于如何将密钥发送到另一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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