Is it possible to poll GetKeyboardSta开发者_开发知识库te()
as a replacement for a global keyboard hook?
I suppose it depends on what you want to do, but probably not.
GetKeyboardState only gets the current state while with the hook you'll get all the keypresses as they come.
I'm not sure if you could even poll it fast enough to be sure to never miss any keypress, but even if you did, if for example the A key was pressed during one poll, and the A key still has the state of pressed during the next poll, how could you tell if that was one long or two fast keypresses.
精彩评论