Iterating over GetASyncKeystate function once

Hello,

I've been trying to find a way to make my program iterate only once over a function when I press a key instead of multiple times, which it is doing now. I rather not use Sleep(), because I'm hooking a running process which I do not want to halt. Thank you!

1
2
3
4
5
6
7
8
9
void Switch()
{

if (GetAsyncKeyState(key))
{
On = !On

}
}
it isn't clear what you want to do
If I use the function I psuedo coded above it will register 1 keypress as multiple keypresses. So the 'switch' is going true and false multiple times and its a guess on which it will land. I just want the bool to switch only once when I press the vkey.
Topic archived. No new replies allowed.