keyDown完成后如何获取键盘键号? [英] How to get Keyboard Keys Number when keyDown is done?
本文介绍了keyDown完成后如何获取键盘键号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查键盘键号示例17 = w
How to check KeyBoard Key Number example 17=w
1=Esc
2=1
3=2
4=3
5=4
6=5
7=6
8=7
9=8
10=9
11=0
,因此是标准值.
当调用WM_KEYDOWN事件时.
so on which are standard values.
when WM_KEYDOWN event is called.
推荐答案
问题尚不清楚,但是我可以通过键号"猜测您的意思是原始键标识符(该标识符先于键被识别为状态键,字符键等),称为"扫描代码".您可以将其作为CWnd::OnKeyDown
的参数nFlags
的低字节来获取;请参阅:
http://msdn.microsoft.com/en-us/library/983st27a%28v = vs.100%29.aspx [ ^ ].
另请参见: http://en.wikipedia.org/wiki/Scan_code [
The question is not clear, but I can guess by "key number" you mean a raw key identifier (which comes into play before a key is recognized as a status key, character key, etc.), which is called "scan code". You can get it as lower byte of the parameternFlags
ofCWnd::OnKeyDown
; please see:
http://msdn.microsoft.com/en-us/library/983st27a%28v=vs.100%29.aspx[^].
See also: http://en.wikipedia.org/wiki/Scan_code[^].
You can extract scan code fromnFlags
like this:
byte scanCode = nFlags & 0xFF;
这篇关于keyDown完成后如何获取键盘键号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文