按住键盘琴键 [英] Hold Keyboard key
本文介绍了按住键盘琴键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我想按任何键,例如F12.我使用了System.Windows.Forms.SendKey("{F12}")
,但是我认为它仅在几毫秒内执行命令,因此我需要至少按住此按钮0.5秒钟,以使另一个程序对此按钮作出反应.当我多次重复此代码时,它没有帮助
感谢您的帮助.
Hello!
I want to press any key for example F12. I used System.Windows.Forms.SendKey("{F12}")
but i think it execute command only in miliseconds and i need hold this button minimum for 0.5 second to Another program react this Button. When i repeat this code more times it dont helps
Thanks for help.
推荐答案
创建一个线程,该线程重复调用SendKey
持续0.6秒.
编辑=============
现在不能测试吗?WTF是什么意思?
您也可以发布WM_KEYDOWN命令,等待0.6秒,然后发布WM_KEYUP命令.您将必须使用pInvoke来做到这一点.谷歌在这两个方面都是您的朋友(使用pInvoke并发布Windows命令).
Create a thread that repeatedly callsSendKey
for 0.6 seconds.
EDIT =============
Can''t test it now?WTFdoes that mean?
You could also post a WM_KEYDOWN command, wait .6 seconds, and the post a WM_KEYUP command. You''re going to have to use pInvoke to do that. Google is your friend for both things (using pInvoke, and posting windows commands).
这篇关于按住键盘琴键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文