sendkeys有时会输入错误的字符 [英] sendkeys types wrong character sometimes

查看:138
本文介绍了sendkeys有时会输入错误的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有时,sendkeys会输入错误的字符。我可以使用哪些其他方法键入另一个进程的键?我还需要发送功能键,键修饰符(alt,shift,ctrl)并支持unicode。我正在考虑使用sendinput
的pinvoke,但是我将sendkeys配置为使用sendinput,所以我不确定如果我走这条路线会有什么不同。其他选择?


已发送:BLAH1a

键入:BLAH!a




发送:+ ^%] [〜)(
$
输入:+ ^%] [〜0(

  线程  睡眠   250  );   
SendKeys SendWait < span class ="pun">( temp );
SendKeys Flush ();

https://stackoverflow.com/questions/52667332/sendkeys-types-wrong-character-有时是

解决方案

Hello wallst23,


1。令人惊讶的是,当你发送"BLAH1a"时;字符串,它被翻译成"BLAH!a"代替。这不应该发生。


2。但是,它确实意味着在键盘上,代表'1'字符的键也用于'!'字符。


3。请尝试使用以下字符串:"BLAH + 1a"。


- "+"将按下SHIFT键发送"1"字符。


4。请参阅
SendKeys Class
有关如何发送保留字符的更多信息。


- 生物。




On occasion sendkeys will type the wrong character. What other methods could I use to type keys to another process? I need to also send function keys, key modifiers (alt,shift,ctrl) and also support unicode. I was thinking about using pinvoke of sendinput but I have sendkeys configured to use sendinput so I'm not sure what if anything would be different if I went that route. Other options?

sent: BLAH1a
typed: BLAH!a


sent: +^%][~)(
typed: +^%][~0(

Thread.Sleep(250);
SendKeys.SendWait(temp);
SendKeys.Flush();

https://stackoverflow.com/questions/52667332/sendkeys-types-wrong-character-sometimes

解决方案

Hello wallst23,

1. It is surprising that when you sent the "BLAH1a" string, it gets translated into "BLAH!a" instead. This should not have happened.

2. However, it does imply that on your keyboard, the key that represents the '1' character is also used for the '!' character.

3. Try the following string instead : "BLAH+1a".

- The '+' will send the '1' character with the SHIFT key pressed.

4. See SendKeys Class for more information on how to send reserved characters.

- Bio.


这篇关于sendkeys有时会输入错误的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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