windows 模拟键盘

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6384082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:04:51  来源:igfitidea点击:

Emulate keyboard

c#windowsvisual-studio-2010

提问by Jacek Koralik

How can I emulate keyboard in application running in background (hidden in tray). I want to press, hold, and relase keys on keyboard programatically. Also, I would like to move mouse around and be able to click.

如何在后台运行的应用程序中模拟键盘(隐藏在托盘中)。我想以编程方式按下、按住和释放键盘上的键。另外,我想移动鼠标并能够点击。

回答by Rajeev

You can use SendInput APIfunction

您可以使用SendInput API函数