开发者

send "spacebar key" using SendKeys.sendwait()

开发者 https://www.devze.com 2023-01-05 03:03 出处:网络
开发者_开发百科I was wondering how to send spacebar key usingSendKeys.send(); It works with the other keys but only the spacebar !!
开发者_开发百科

I was wondering how to send spacebar key using SendKeys.send(); It works with the other keys but only the spacebar !!

Here is the link where I found the other keys http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx


Per the documentation you linked, SendKeys.send(" "); will send a space key.

The only keys which require special codes are "characters that aren't displayed when you press a key".


A normal space with double quotes works SendKeys.SendWait(" ")

...but if you are sending characters as Char instead of String as the arguments make sure to replace the Char space with a String space.

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


Use application.sendkeys "{SPACE}"

0

精彩评论

暂无评论...
验证码 换一张
取 消