Can I poll GetKeyboardState () as a replacement for the global keyboard?

Can I interrogate GetKeyboardState()as a replacement for the global keyboard?

+3
source share
1 answer

I suppose it depends on what you want to do, but probably not.
GetKeyboardState only gets the current state, and with a hook you get all the keystrokes as they arrive.
I’m not sure that you can even interrogate it fast enough so that you don’t miss a single keystroke, but even if you did it if, for example, you pressed the A key during one poll and the A key still had the state pressed during next polling time, as you might say, whether it was one long or two quick keystrokes.

+4
source

Source: https://habr.com/ru/post/1740633/


All Articles