Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以轮询GetKeyboardState()作为全局键盘挂钩的替代品?
GetKeyboardState()
我想这取决于你想做什么,但可能不是。 GetKeyboardState 仅获取当前状态,而使用钩子您将获得所有按键。 我不确定您是否可以足够快地轮询它以确保不会错过任何按键,但即使您这样做了,例如,如果在一次轮询期间按下了 A 键,并且 A 键仍然处于按下状态在下一次民意调查中,你怎么知道那是一次长按键还是两次快速按键。