使用 SendKeys.sendwait() 发送“空格键”

问题描述 投票:0回答:4

我想知道如何使用

SendKeys.send();
发送spacebar key 它可以与其他键一起使用,但只能与空格键一起使用!!
这是我找到其他键的链接http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

c# .net sendkeys
4个回答
38
投票

根据您链接的文档,

SendKeys.send(" ");
将发送一个空格键。

唯一需要特殊代码的键是“按下键时不显示的字符”。


0
投票

带双引号的普通空格有效

SendKeys.SendWait(" ")

...但是如果您将字符作为

Char
而不是
String
作为参数发送,请确保将
Char
空格替换为
String
空格。

if (chr == ' ')
{
    SendKeys.SendWait(" ");
}else{
    SendKeys.SendWait("{"+chr+"}");
}

0
投票

在 Windows 上的 VBScript 中,您可以像这样打开活动窗口的系统菜单(论坛建议将 4 种语言作为标题,js 最近):

oShell.SendKeys "%{ }", true
oShell.SendKeys "~", true


-8
投票

使用 application.sendkeys "{SPACE}"

© www.soinside.com 2019 - 2024. All rights reserved.