Why do i get more than 1 (a few hundred) key hit on a single press while using GetAsyncKeyState. It prints a hundred of a same key while i just pressed it once.
Thanks,
Why do i get more than 1 (a few hundred) key hit on a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
GetAsyncKeyStatetells you the state of the keyboard, whether a key is down/up, not whether it has been pressed since last call. If you call it in a loop, you will get “key is down” for as long as you keep the key down – and that loop executes a lot faster than you can move your fingers.If you want keyboard events handle
WM_KEYDOWNandWM_KEYUP.If you want a global hotkey, use
RegisterHotKey