• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Automated key holding

DunM@

Limp Gawd
Joined
Apr 2, 2002
Messages
316
Hello all, I'm trying to find some software mechanism by which I can convince windows that I'm holding down a key on the keyboard (as opposed to pressing it over and over again quickly) so that I can more accurately test my games (current automation schemes just end up pushing the button over and over quickly rather than holding it). I know I could build in a backdoor that allows this, but I'm looking for a more generic (read: lazy) way to do it. Any links/samples would be GREATLY appreciated, google has yet to give me anything close...
 
When you strike a key in Windows, the window with input focus gets WM_KEYDOWN. It'll get WM_CHAR once, then it'll get WM_CHAR again and again as the key repeats. Then, it'll get WM_KEYUP.

I guess you'll want to fake these messages -- but I don't know how that maps to DirectInput, which I'd assume your game is using.
 
mikeblas is right as usual, I'd just point you to the keybd_event Windows API function which may do the trick?
 
If you are looking to automate games, you might want to check out Autoit script. To hold down the shift key, and let go of it after one second, you can write:
Code:
Send("{shiftdown}")
Sleep(1000)
Send("{shiftup}")

 
Back
Top