Click here to Skip to main content
15,606,999 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Updated 11-Oct-10 2:18am

1 solution

Create a thread that repeatedly calls SendKey for 0.6 seconds.

EDIT =============

Can't test it now? WTF does 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).
Share this answer
Sandeep Mewara 11-Oct-10 9:57am    
Comment from OP:
Hi thanks for reply cant test it now, but exist another method to do that than cycle?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900