如何通过扫描码(不是虚拟键码)获取键状态? [英] How to get the key state via a scancode (not virtual keycode)?

查看:120
本文介绍了如何通过扫描码(不是虚拟键码)获取键状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否仅使用扫描码就可以获取键盘按键的状态(按下或按下)?我在win32中找不到任何函数.有谁知道实现此目的的任何方法吗?

Is there anyway to get the state of a keyboard key (is it down or up) using just a scancode? I can't find any function in win32 for this. Anyone know any way to achieve this?

p.s.我需要键盘的实际状态,而不是从Windows消息(如GetKeyState返回)得出的状态.

p.s. I need the actual state of the keyboard not the state derived from windows messages like GetKeyState returns.

推荐答案

您将必须使用 GetKeyboardState ,因为没有一个WinAPI键功能直接使用扫描代码

You'll have to use the MapVirtualKey function, using MAPVK_VSC_TO_VK as the mode, and pass the output to GetKeyState or GetKeyboardState, as none of the WinAPI key functions directly use scan codes

这篇关于如何通过扫描码(不是虚拟键码)获取键状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆