Keyboard code
key code 组合键 原理
key code 组合键原理键码组合键是指按下多个键盘上的按键来完成某个特定操作或触发某个功能。
在计算机操作中,键码组合键起到了非常重要的作用,可以提高操作效率和便捷性。
下面我将介绍一些常见的键码组合键及其原理。
1. Ctrl + C/V/XCtrl键位于键盘左下角,通过与其他按键组合使用可以实现不同的功能。
Ctrl + C用于复制选中的内容,Ctrl + V用于粘贴复制的内容,Ctrl + X用于剪切选中的内容。
这些组合键的原理是,当按下Ctrl键的同时再按下相应的字母键,计算机会识别到这个组合,并执行相应的操作。
2. Alt + TabAlt键位于键盘左下角,Tab键位于键盘上方的第三行。
Alt + Tab组合键用于在多个打开的窗口之间切换。
按下Alt键不放,然后反复点击Tab键,可以在不同的窗口之间快速切换。
这个组合键的原理是,当按下Alt键的同时再按下Tab键,计算机会显示出所有打开的窗口,并在按下Tab键的同时切换焦点。
3. Ctrl + Z/YCtrl + Z用于撤销上一步操作,Ctrl + Y用于恢复撤销的操作。
这些组合键的原理是,计算机会将每一步的操作都保存在内存中,当按下Ctrl + Z时,计算机会从内存中找到上一步的操作,并执行撤销。
而当按下Ctrl + Y时,计算机会从内存中找到已撤销的操作,并执行恢复。
4. Ctrl + Shift + EscCtrl + Shift + Esc组合键用于打开任务管理器,可以查看当前正在运行的程序和进程,并进行相应的管理。
这个组合键的原理是,当按下Ctrl键和Shift键的同时再按下Esc键时,计算机会识别到这个组合,并打开任务管理器。
5. Ctrl + Alt + DelCtrl + Alt + Del组合键用于强制关闭当前程序或重启计算机。
这个组合键的原理是,当按下Ctrl键和Alt键的同时再按下Del键时,计算机会执行相应的操作。
在Windows系统中,这个组合键还有其他作用,比如打开安全选项等。
快捷键的编码
0x01 VK_RBUTT ON 0x02 VK_CANCEL
0x03 VK_MBUTT ON
0x04 VK_XBUTT ON1 0x05 VK_XBUTT ON2 0x06 0x07 VK_BACK
0x08 VK_TAB 0x09 0x0A-0B VK_CLEAR 0x0C VK_RETUR N 0x0D 0x0E-0F VK_SHIFT 0x10 VK_CONTR OL 0x11 VK_MENU 0x12 VK_PAUSE 0x13 VK_CAPITA L 0x14 VK_KANA
VK_LEFT = 0x25,
[Description( "UP ARROW key")]
VK_UP = 0x26,
[Description( "RIGHT ARROW key")]
VK_RIGHT = 0x27,
[Description( "DOWN ARROW key")]
VK_DOWN = 0x28,
[Description( "IME convert")]
VK_CONVER T = 0x1C,
[Description( "IME nonconvert" )] VK_NONCO NVERT = 0x1D,
[Description( "IME accept")]
VK_ACCEPT = 0x1E,
Vir
tua
l-
Ke
y
Co
de
s
The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric Constant/v alue VK_LBUTTO N
键盘扫描码
键盘扫描码一. 键盘的构造及历史对于键盘,如果想要表示某个按键,硬件上对应着某个点,有两种方法。
一种是对于每个按键,都设计一个硬件的点。
一种是设计成矩阵式,即由多少行,多少列所组成。
举例说明:某个键盘一共需要35个按键。
前者是要设计35个硬件上的点。
后者只需要设计7行5列即可实现7×5=35个按键。
行列的矩阵式,比独立的点的方式,硬件上更容易实现。
矩阵式的键盘普通PC上的键盘,由于按键太多,为了之后的普及和通用性,要有个统一的标准,去定义哪个键值对应到键盘上的哪个按键。
因此,才会出现扫描码Scan Code。
二. 键盘中的扫描码Scan Code从按下一个键盘上的字母,到手松开,实际上对应着一个通码Make Code和一个断码Break Code,两者概念上都属于扫描码ScanCode。
对应的按下键的动作产生的键码叫做通码Make Code。
释放的时候电路被断开产生的键码叫做断码Break Code。
三. 扫描码集合Scan Code Set目前现存有3种Scan Code即,Scan Code Set1(第一种扫描码集合)。
Scan Code Set2。
Scan Code Set3。
四. 第一种扫描码集合Set1的Scan Code的Make Code和Break Code都是单字节。
Make code和Break Code的差别就在最高位,即Break code = make code + 0x80将make code的最高位置1就是Break Code。
五. 键盘常见流程(1)用户按下键盘上的某个键(2)键盘的硬件产生Scan Code,其中目前常见的AT键盘中用的是Set2的Scan Code。
按下是Make Code,释放是Break Code (3)键盘的控制器将Set2的Scan Code转化为Set1的Scan Code。
A. 此处是为了兼容旧的Scan Code Set1才去将Set2转为Set1。
WINTEC-KB66U可编程键盘用户手册
KB66U可编程键盘用户手册一.程序安装⒈先运行setup.exe程序,然后出现以下对话框。
按“Next”键继续⒉同意协议与否选择对话框,“Yes”键继续。
⒊用户信息确认对话框,按“Next”键继续⒋安装路径对话框,选择目标文件夹,然后按“Next”键继续。
⒌拷贝文件对话框,按“Next”键继续。
⒍提示重启计算机对话框,按”Finish”重启后设置生效。
二.键盘的编程软件1.选择键盘当运行程序时会出现以下对话框:选择所想编程的产品类型,然后按“确定”键确定。
2. 编辑键码拖动鼠标,使鼠标指在键盘的某一个按钮上,当按钮颜色变成灰黑色时就可以对此按钮编程了。
在可编程的按键上点击鼠标左键,会弹出一个滑行菜单。
这时可以用“Key Code”的方式给按键赋值,或者“ASCII CODE”的方式给按键赋值。
,你还可以点击滑行菜单条中“Clear”来清除已赋的码值,给一个按键赋值后,点击“Layer Index”来指定这个按键的键层。
Ⅰ.Key code在这种方式下,你能用任意扫描码给一个按键赋值在以上对话框的“键盘”画面上显示了最常用的键码,并在“Special Codes”区域列出了一些特殊码。
从“键盘”画面上选择一个键或双击“Special Codes”区域的某一项,则将其键码添加到“Mapping Sequence”目录中。
通过以上操作可以把8个码写入某一个键里面。
在这个画面上并不是任何键码(扫描码)都是可选的,但可以在“0x”下的方格内输入一个十六进制码,然后按“Insert”确定。
例如:如果在“键盘”区域按“Shift”、“H”、“E”、“Shift”、“L”、“L”以及“O”键,在上面对话框中的“Mapping Sequence”目录中就会显示这些键值。
如果在上面的“Mapping Sequence”目录中删除“O”项,你可以用鼠标右键单击“O”项,将弹出一个包含2 个选项的滑行菜单。
选择其中的“Delete”选项就可以删除“O”项内容;如果选择“Clear All”选项,就会把该目录中的所有内容删除。
键盘按键对应的编码
键盘按键对应的编码
键盘按键对应的编码通常是通过使用ASCII码(American Standard Code for Information Interchange)或Unicode编码来表示的。
这些编码用于将键盘上的每个按键映射到特定的字符或控制码。
下面是一些常见的键盘按键和它们对应的ASCII码或Unicode编码:
1. 字母键:A-Z对应的ASCII码为65-90(大写字母)和97-122(小写字母)。
2. 数字键:0-9对应的ASCII码为48-57。
3. 功能键:F1-F12对应的ASCII码为112-123。
4. 控制键:例如Enter键对应的ASCII码为13,Tab键对应的ASCII码为9,空格键对应的ASCII码为32,退格键对应的ASCII码为8。
5. 特殊符号键:例如感叹号键对应的ASCII码为33,问号键对应的ASCII 码为63,加号键对应的ASCII码为43,等等。
Unicode编码是一种更为全面的字符编码系统,它包含了全球范围内的各种字符和符号。
Unicode编码使用16位或32位来表示每个字符,包括了各种语言的字母、标点符号、数学符号、货币符号等等。
需要注意的是,不同的操作系统和键盘布局可能会有一些细微的差异,因此具体的键盘按键编码可能会有所不同。
如果需要获取特定键盘按键的编码,最好
参考相关的文档或编程语言的API文档。
键盘码
2PS/2键盘的编码与命令集(1)PS/2键盘的编码现在PC机使用的PS/2键盘都默认采用第二套扫描码集。
该扫描码集可参考文献\[1\]。
扫描码有两种不同的类型:通码(make code)和断码(break code)。
当一个键被按下或持续按住时,键盘会将该键的通码发送给主机;而当一个键被释放时,键盘会将该键的断码发送给主机。
根据键盘按键扫描码的不同,在此可将按键分为如下几类:第一类按键,通码为1字节,断码为0xF0+通码形式。
如A键,其通码为0x1C,断码为0xF0 0x1C。
第二类按键,通码为2字节0xE0+0xXX形式,断码为0xE0+0xF0+0xXX形式。
如right ctrl键,其通码为0xE0 0x14,断码为0xE0 0xF0 0x14。
第三类特殊按键有两个,print screen键通码为0xE0 0x12 0xE0 0x7C,断码为0xE0 0xF0 0x7C 0xE0 0xF0 0x12; pause键通码为0x E1 0x14 0x77 0xE10xF0 0x14 0xF0 0x77,断码为空。
组合按键的扫描码发送按照按键发生的次序,如以下面顺序按左SHIFT+A键:1按下左SHIFT键,2按下A键,3释放A键,4释放左SHIFT键,那么计算机上接收到的一串数据为0x12 0x1C 0xF0 0x1C 0xF0 0x12。
在驱动程序设计中,就是根据这样的分类来对不同的按键进行不同处理的。
(2)PS/2键盘的命令集主机可以通过向PS/2键盘发送命令来对键盘进行设置或者获得键盘的状态等操作。
每发送一个字节,主机都会从键盘获得一个应答0xFA(“重发resend”和“回应echo”命令例外)。
下面简要介绍驱动程序在键盘初始化过程中所用的指令(详细键盘命令集见参考文献\[1\]):0xED主机在本命令后跟随发送一个参数字节,用于指示键盘上num lock, caps lock, scroll lock led的状态;0xF3主机在这条命令后跟随发送一个字节参数来定义键盘机打的速率和延时;0xF4用于在当主机发送0xF5禁止键盘后,重新使能键盘。
python keyboard库用法 -回复
python keyboard库用法-回复Keyboard库是一个在Python中实现按键监控和模拟按键操作的第三方库。
它提供了一系列函数和方法,使得我们可以轻松地实现键盘事件的监听和模拟,从而可以在编程中自动化处理键盘输入。
本文将详细介绍Keyboard库的用法,包括安装与导入、键盘事件监听、模拟按键操作等主要内容。
1. 安装和导入Keyboard库:要使用Keyboard库,首先需要安装它。
可以通过在命令行窗口中运行以下命令进行安装:pip install keyboard安装完成后,在Python脚本中导入Keyboard库:pythonimport keyboard2. 监听键盘事件:Keyboard库提供了丰富的函数和方法,可以用于监听键盘事件。
下面是一些常用的键盘事件监听函数:- `keyboard.is_pressed(key)`- 功能:判断某个键是否被按下- 参数:key - 键的名称或键码- 返回值:True - 如果键被按下;False - 如果键未被按下- 示例:pythonif keyboard.is_pressed('a'):print('键a 被按下')- `keyboard.wait(key=None)`- 功能:阻塞程序直到某个键被按下- 参数:key - 键的名称或键码(可选)- 返回值:None- 示例:pythonkeyboard.wait('enter') # 阻塞程序直到回车键被按下- `keyboard.add_hotkey(hotkey, callback, suppress=False)`- 功能:注册快捷键- 参数:hotkey - 快捷键的名称或键码;callback - 当快捷键被按下时要执行的回调函数;suppress - 是否要阻止快捷键的默认行为(可选,默认为False)- 返回值:None- 示例:pythondef callback():print('快捷键被按下')keyboard.add_hotkey('ctrl+alt+a', callback)3. 模拟按键操作:除了监听键盘事件,Keyboard库还提供了模拟按键操作的函数,可以用于在编程中自动化触发键盘输入。
python keyboard库用法
python keyboard库用法Python的keyboard库是一个用于监控和控制键盘事件的库。
它可以用于模拟键盘输入、监听按键事件以及进行特定的键盘操作。
本文将介绍keyboard库的使用方法,并给出一些示例代码和应用场景。
keyboard库的安装非常简单,只需要使用pip命令即可完成安装。
在命令行中输入以下命令即可安装keyboard库:```pip install keyboard```安装完成后,就可以在Python代码中引入keyboard库并开始使用了。
首先,我们可以使用keyboard模块的`add_hotkey`方法来注册热键。
热键是一种快捷键的扩展,当按下指定的组合键时,可以执行特定的操作。
下面是一个使用`add_hotkey`方法注册热键的示例代码:```pythonimport keyboarddef on_hotkey():print("Hotkey pressed!")keyboard.add_hotkey('ctrl+shift+a', on_hotkey)keyboard.wait('esc')```在上面的代码中,我们定义了一个名为`on_hotkey`的函数,当热键被按下时,该函数会被调用并打印出一条消息。
然后,我们使用`add_hotkey`方法注册了一个热键,当同时按下`ctrl+shift+a`组合键时,会触发这个热键。
最后,我们使用`wait`方法来等待`esc`键的按下,以保持程序运行。
除了热键注册,keyboard库还可以用于监听按键事件。
我们可以使用`keyboard.on_press`和`keyboard.on_release`方法来注册按键按下和抬起的事件处理函数。
下面是一个监听按键事件的示例代码:```pythonimport keyboarddef on_press(event):print(f'Key {} pressed')def on_release(event):print(f'Key {} released')keyboard.on_press(on_press)keyboard.on_release(on_release)keyboard.wait('esc')```在上面的代码中,我们定义了两个函数`on_press`和`on_release`,分别用于处理按键按下和抬起的事件。
键盘扫描码key_code
键盘扫描码Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEXDEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B |4064 F601 1 ESC |11 17 W |21 33 F |31 49 N |4165 F702 2 1 |12 18 E |22 34 G |32 50 M |4266 F803 3 2 |13 19 R |23 35 H |33 51 , |4367 F904 4 3 |14 20 T |24 36 J |34 52 . |4468 F1005 5 4 |15 21 Y |25 37 K |35 53 / |4569 Num06 6 5 |16 22 U |26 38 L |36 54 RShift|46 70 Scroll07 7 6 |17 23 I |27 39 ; |37 55 PrtSc |4771 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |4872 Up09 9 8 |19 25 P |29 41 ` |39 57 Space |4973 PgUp0A 10 9 |1A 26 [ |2A 42 LShift|3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B75 Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F79 End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | | ---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|NumLok|Scr Lok|| | | | | | | | | | | | | | | | || ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69 | 70 | |3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E| 45 | 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 38 | 9 3 - || | | | | | | | | | | | | | | | | 3| 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372|73 374 ||3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348|49 34A |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | ; | ' | ` |28 | 4 35 |6 3 || | | | | | | | | | | | | | | | | 3| 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376|77 3 ||3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C|4D 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 32 |3 3 + || | | | | | | | | | | | | | | | | 3| 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380|81 378 ||41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350|51 34E |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3D|l 3 || | | | | | | | | | | | | | | | | 3| 3 ||67|68| 5| | | | | |57| | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39| | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the special codes are to be applied.)HEX DEC keys-------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P1E 30 Alt-A1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L2C 44 Alt-Z2D 45 Alt-X2E 46 Alt-C2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M3B 59 F13C 60 F23D 61 F33E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F6 5A 90 Shift-F7 5B 91 Shift-F8 5C 92 Shift-F9 5D 93 Shift-F105F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F26A 106 Alt-F36B 107 Alt-F46C 108 Alt-F56D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-082 130 Alt--83 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down8B 139 Ctrl-Del8C 140 Alt-Home8D 141 Alt-Up8E 142 Alt-PgUp8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-Ins98 152 Alt-DelExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DECkeys------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc|------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E142 Alt-PgUp4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F143 Alt--(num)4B 75 Left | | 73 115 Ctrl-Left | 90144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91145 Alt-Center4D 77 Right | | 74 116 Ctrl-Right| 92146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93147 Alt-+(num)4F 79 End | | 75 117 Ctrl-End | 94148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 | 69105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71113 Alt-F10------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 |30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 |2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 |20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 |12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 |17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= |32 50 Alt-M | 2C 44 Alt-Z |PC机和键盘部分通信命令字PC机向键盘发出的命令共有10条,键盘向PC机发出的键盘响应共有7条。
键盘码表,键盘扫描码,asc2码
Text onlyÓïÑÔ: ¼üÅÌÂë±í£¨VK_XX virtual key)------------------- virtual key value table by/code/ ----------------0x00-07 ! LBUTTON RBUTTON CANCEL MBUTTON ! ! !0x08-0F BACK TAB ! ! CLEAR RETURN ! !0x10-17 SHIFT CONTROL MENU PAUSE CAPITAL HANGUL ! JUNJA0x18-1F FINAL KANJI ! ESCAPE CONVERT NONCONVERT ACCEPT MODECHANGE0x20-27 SPACE PRIOR NEXT END HOME LEFT UP RIGHT0x28-2F DOWN SELECT PRINT EXECUTE SNAPSHOT INSERT DELETE HELP0x30-37 0 1 2 3 4 5 6 70x38-3F 8 9 ! ! ! ! ! !0x40-47 ! A B C D E F G0x48-4F H I J K L M N O0x50-57 P Q R S T U V W0x58-5F X Y Z LWIN RWIN APPS ! !0x60-67 NUMPAD0 NUMPAD1 NUMPAD2 NUMPAD3 NUMPAD4 NUMPAD5 NUMPAD6 NUMPAD70x68-6F NUMPAD8 NUMPAD9 MULTIPLY ADD SEPARATOR SUBTRACT DECIMAL DIVIDE0x70-77 F1 F2 F3 F4 F5 F6 F7 F80x78-7F F9 F10 F11 F12 F13 F14 F15 F160x80-87 F17 F18 F19 F20 F21 F22 F23 F240x88-8F ! ! ! ! ! !! !0x90-97 OEM_NUMBER OEM_SCROLLOEM_SHIFT ! ! ! ! !0x98-9F ! ! ! ! ! !! !0xA0-A7 LSHIFT RSHIFT LCONTROL RCONTROL LMENU RMENU ! !0xA8-AF ! ! ! ! ! !! !0xB0-B7 ! ! ! ! ! !! !0xB8-BF ! OEM_0 OEM_1 OEM_PLUS OEM_COMMA OEM_MINUS OEM_PERIOD OEM_20xC0-C7OEM_3 ! ! ! ! ! ! !0xC8-CF ! ! ! ! ! !! !0xD0-D7 ! ! ! ! ! !! !0xD8-DF ! ! ! OEM_4 OEM_5 OEM_6 OEM_7 OEM_80xE0-E7 OEM_9 OEM_AX OEM_BSLASH ! ! PROCESSKEY ! !0xE8-EF ! ! ! ! ! !! !0xF0-F7 ! ! ! ! ! ! ATTN CRSEL0xF8-FF EXSEL EREOF PLAY ZOOM NONAME PA1 OEM_CLEAR !Text onlyÓïÑÔ: ¼üÅÌɨÃèÂë(È«)Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DECkeys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B |40 64 F601 1 ESC |11 17 W |21 33 F |31 49 N |41 65F702 2 1 |12 18 E |22 34 G |32 50 M |42 66 F803 3 2 |13 19 R |23 35 H |33 51 , |43 67 F904 4 3 |14 20 T |24 36 J |34 52 . |44 68F1005 5 4 |15 21 Y |25 37 K |35 53 / |45 69 Num06 6 5 |16 22 U |26 38 L |36 54 R Shift|46 70 Scroll07 7 6 |17 23 I |27 39 ; |37 55 PrtSc |47 71 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |48 72Up09 9 8 |19 25 P |29 41 ` |39 57 Space |49 73 PgUp0A 10 9 |1A 26 [ |2A 42 L Shift|3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B 75Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C 76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D 77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E 78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F 79End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | |---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|Num Lok|ScrLok|| | | | | | | | | | | | | | | | | | ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69| 70 ||3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E | 45| 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 3 8 | 9 3 - || | | | | | | | | | | | | | | | | 3 | 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372 |73 374 ||3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348 |49 34A |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | ; | ' | ` |28 | 4 3 5 | 6 3 || | | | | | | | | | | | | | | | | 3 | 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376 |77 3 ||3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C |4D 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 3 2 | 3 3 + || | | | | | | | | | | | | | | | | 3 | 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380 |81 378 ||41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350 |51 34E |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3 D|l 3 || | | | | | | | | | | | | | | | | 3 | 3 ||67|68| 5| | | | | |57 | | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39 | | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the special codes are to be applied.)HEX DEC keys-------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P1E 30 Alt-A1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L2C 44 Alt-Z2D 45 Alt-X2E 46 Alt-C2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M3B 59 F13C 60 F23D 61 F33E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F65A 90 Shift-F75B 91 Shift-F85C 92 Shift-F95D 93 Shift-F10 5E 94 Ctrl-F15F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F26A 106 Alt-F36B 107 Alt-F46C 108 Alt-F56D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-082 130 Alt--83 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down8A 138 Ctrl-Ins8B 139 Ctrl-Del8C 140 Alt-Home8D 141 Alt-Up8E 142 Alt-PgUp8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-Ins98 152 Alt-DelExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DEC keys------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc|------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C 140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D 141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E 142 Alt-PgUp4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F 143 Alt--(num)4B 75 Left | | 73 115 Ctrl-Left | 90 144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91 145 Alt-Center4D 77 Right | | 74 116 Ctrl-Right| 92 146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93 147 Alt-+(num)4F 79 End | | 75 117 Ctrl-End | 94 148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95 149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96 150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97 151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98 152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68 104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 | 69 105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A 106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B 107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C 108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D 109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E 110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F 111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70 112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71 113 Alt-F10------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 |30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 |2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 |20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 |12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 |17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= |32 50 Alt-M | 2C 44 Alt-Z | |------------------+-------------------+-------------------+--------------------Text onlyÓïÑÔ: AsciiÂë±í£¨È«£©ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)Decimal Octal Hex Binary Value------- ----- --- ------ -----000 000 000 00000000 NUL (Null char.)001 001 001 00000001 SOH (Start of Header)002 002 002 00000010 STX (Start of Text)003 003 003 00000011 ETX (End of Text)004 004 004 00000100 EOT (End of Transmission) 005 005 005 00000101 ENQ (Enquiry)006 006 006 00000110 ACK (Acknowledgment)007 007 007 00000111 BEL (Bell)008 010 008 00001000 BS (Backspace)009 011 009 00001001 HT (Horizontal Tab)010 012 00A 00001010 LF (Line Feed)011 013 00B 00001011 VT (Vertical Tab)012 014 00C 00001100 FF (Form Feed)013 015 00D 00001101 CR (Carriage Return)014 016 00E 00001110 SO (Shift Out)015 017 00F 00001111 SI (Shift In)016 020 010 ******** DLE (Data Link Escape)017 021 011 00010001 DC1 (XON) (Device Control 1) 018 022 012 00010010 DC2 (Device Control 2) 019 023 013 00010011 DC3 (XOFF)(Device Control 3) 020 024 014 00010100 DC4 (Device Control 4) 021 025 015 00010101 NAK (Negative Acknowledgement)022 026 016 00010110 SYN (Synchronous Idle)023 027 017 00010111 ETB (End of Trans. Block) 024 030 018 00011000 CAN (Cancel)025 031 019 00011001 EM (End of Medium)026 032 01A 00011010 SUB (Substitute)027 033 01B 00011011 ESC (Escape)028 034 01C 00011100 FS (File Separator)029 035 01D 00011101 GS (Group Separator)030 036 01E 00011110 RS (Request to Send)(Record Separator)031 037 01F 00011111 US (Unit Separator)032 040 020 ******** SP (Space)033 041 021 ******** ! (exclamation mark)034 042 022 ******** " (double quote)035 043 023 ******** # (number sign)036 044 024 ******** $ (dollar sign)037 045 025 ******** % (percent)038 046 026 00100110 & (ampersand)039 047 027 ******** ' (single quote)040 050 028 ******** ( (left/opening parenthesis)041 051 029 ******** ) (right/closing parenthesis)042 052 02A 00101010 * (asterisk)043 053 02B 00101011 + (plus)044 054 02C 00101100 , (comma)045 055 02D 00101101 - (minus or dash)046 056 02E 00101110 . (dot)047 057 02F 00101111 / (forward slash)048 060 030 00110000 0049 061 031 00110001 1050 062 032 00110010 2051 063 033 00110011 3052 064 034 00110100 4053 065 035 00110101 5054 066 036 00110110 6055 067 037 00110111 7056 070 038 00111000 8057 071 039 00111001 9058 072 03A 00111010 : (colon)059 073 03B 00111011 ; (semi-colon)060 074 03C 00111100 < (less than)061 075 03D 00111101 = (equal sign)062 076 03E 00111110 > (greater than)063 077 03F 00111111 ? (question mark)064 100 040 01000000 @ (AT symbol)065 101 041 01000001 A066 102 042 01000010 B067 103 043 01000011 C068 104 044 01000100 D069 105 045 01000101 E070 106 046 01000110 F071 107 047 01000111 G072 110 048 01001000 H073 111 049 01001001 I074 112 04A 01001010 J075 113 04B 01001011 K076 114 04C 01001100 L077 115 04D 01001101 M078 116 04E 01001110 N079 117 04F 01001111 O080 120 050 01010000 P081 121 051 01010001 Q082 122 052 01010010 R083 123 053 01010011 S084 124 054 01010100 T085 125 055 01010101 U086 126 056 01010110 V087 127 057 01010111 W088 130 058 01011000 X089 131 059 01011001 Y090 132 05A 01011010 Z091 133 05B 01011011 [ (left/opening bracket)092 134 05C 01011100 \ (back slash)093 135 05D 01011101 ] (right/closing bracket)094 136 05E 01011110 ^ (caret/circumflex)095 137 05F 01011111 _ (underscore)096 140 060 01100000 `097 141 061 01100001 a098 142 062 01100010 b099 143 063 01100011 c100 144 064 01100100 d101 145 065 01100101 e102 146 066 01100110 f103 147 067 01100111 g104 150 068 01101000 h105 151 069 01101001 i106 152 06A 01101010 j107 153 06B 01101011 k108 154 06C 01101100 l109 155 06D 01101101 m110 156 06E 01101110 n111 157 06F 01101111 o112 160 070 01110000 p113 161 071 01110001 q114 162 072 01110010 r115 163 073 01110011 s116 164 074 01110100 t117 165 075 01110101 u118 166 076 01110110 v119 167 077 01110111 w120 170 078 01111000 x121 171 079 01111001 y122 172 07A 01111010 z123 173 07B 01111011 { (left/opening brace) 124 174 07C 01111100 | (vertical bar)125 175 07D 01111101 } (right/closing brace)126 176 07E 01111110 ~ (tilde)127 177 07F 01111111 DEL (delete)------------------------------------------------------------------0 1 2 3 4 5 6 7 8 9 A B C D E F0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US2 SP ! " # $ % & ' ( ) * + , - . /3 0 1 2 3456789:;<=> ?4 @ A B C D E F G H I J K L M N O5 P Q R S T U V W X Y Z [ \ ] ^ _6 ` a b c d e f g h i j k l m n o7 p q r s t u v w x y z { | } ~ DEL------------------------------------------------------------------。
Keyboard Scan Code Specification
Windows Platform Design NotesDesigning Hardware for the Microsoft® Windows® Family of Operating Systems Keyboard Scan Code SpecificationAbstract:This specification details the PS/2 Scan Codes and USB Usage Tables that are validated for compliance to the Microsoft® Windows® Logo Program testing standard. This document details the alternative make and break PS/2 scan code and USB code response for the Windows Logo Key and Application Keys, plus Advanced Configuration and Power Interface (ACPI) power controls.This specification was previous published, with the same content, as “Windows Hardware Quality Labs Keyboard Specification” and also referred to as “Windows Keys Specification” and “New Keys Specification.”Revision 1.3a — March 16, 2000Disclaimer:The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.Microsoft Corporation may have patents or pending patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. The furnishing of this document does not give you any license to the patents, trademarks, copyrights, or other intellectual property rights except as expressly provided in any written license agreement from Microsoft Corporation.Microsoft does not make any representation or warranty regarding specifications in this document or any product or item developed based on these specifications. Microsoft disclaims all express and implied warranties, including but not limited to the implied warranties or merchantability, fitness for a particular purpose and freedom from infringement. Without limiting the generality of the foregoing, Microsoft does not make any warranty of any kind that any item developed based on these specifications, or any portion of a specification, will not infringe any copyright, patent, trade secret or other intellectual property right of any person or entity in any country. It is your responsibility to seek licenses for such intellectual property rights where appropriate. Microsoft shall not be liable for any damages arising out of or in connection with the use of these specifications, including liability for lost profit, business interruption, or any other damages whatsoever. Some states do not allow the exclusion or limitation of liability or consequential or incidental damages; the above limitation may not apply to you.Microsoft, Win32, Windows, and Windows NT are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners.© 1996-2000 Microsoft Corporation. All rights reserved.ContentsWindows Keys Support for Windows Software Applications (4)Key Codes for Scan Code Set 1: (4)Key Codes for Scan Code Set 2: (4)Key Codes for USB Usage Tables: (4)What Software Applications Vendors Should Support and How (4)Windows Logo Key Support (Reserved for Operating System Use) (5)Windows Keys Support for OEMs and Keyboard IHVs (6)Software Support of the Windows Keys in the Windows 95/98 Operating System (6)Special Keys Reserved for OEM Usage (6)Multiple Key Operation Requirements (7)Valid 2-Key Combinations (7)Valid 3-Key Combinations (8)Combinations of 3-Keys which are Unavailable (8)Additional General Requirements (9)LWIN and RWIN Keys as modifiers (9)Building a Keyboard with the Windows Keys (9)Tools Needed to Build a Keyboard with the Windows Keys (9)Microsoft Windows Legal Agreements (9)Steps to Ship a Keyboard with the Windows Logo Keys (10)ACPI Power Management Keys (11)Key Codes for Scan Code Set 1: (11)Key Codes For Scan Code Set 2: (11)Key Codes for USB Usage Tables: (12)Usage Page and Usages for Audio Control (12)Important Design Aspects (13)Sample Firmware Designs (14)Appendix A: Windows Standard PS/2 Scan Codes (15)General Requirements (15)Typematic Characteristics (15)Scan Code Assignments: (15)Additional General Requirements (23)Appendix B: Device Class Power Management v1.0a (24)Scope (24)General Device Power Management Considerations (24)Input Device Power State Definitions (25)Input Device Power Conservation Policy (25)Input Device Wake-up Events (26)Minimum Input Device Power Capabilities (26)Recommendations for Human Interface Devices (27)Recommendations for i8042 keyboards (27)Appendix C: USB Keyboard/Keypad Page (0x07) (28)Footnotes (33)Notice of ChangeThis version of the Keyboard Scan Code Specification details the PS/2 Scan Codes and USB Usage Tables that are validated for compliance to the Microsoft Windows Logo Program testing standard. This document details the alternative make and break PS/2 scan code and USB code response for the Windows Logo key, Application Keys, and Advanced Configuration & Power Interface (ACPI) power controls./This document supercedes all versions of the New Keys Specifications for the Windows Keys and Windows Hardware Quality Labs WHQL Keyboard Specification. There is no change required for developers of Windows-based applications to support any compatible implementation.The requirements for compatibility testing are not changed, and a keyboard vendor can implement these new keys successfully following the 1.0, 1.1, or 1.2 versions of the New Keys Specification. There is no change required for developers of Windows-based applications to support any compatible implementation.Revision HistoryWindows Keys Support for Windows Software ApplicationsThe three Windows K eys report the following key codes in the Microsoft Windows 95, Windows 98, and Windows NT® operating systems, and future versions of Windows operating systems.Key Codes for Scan Code Set 1:Key Codes for Scan Code Set 2:Key Codes for USB Usage Tables:What Software Applications Vendors Should Support and How To provide support for the Windows Keys, an application should support the application key virtual key scan code (5D) as a context menu event similar to a right mouse button click in some applications today.Applications vendors are encouraged to extend their support beyond the application key to include support for application key combinations like CTRL+Application, A LT+Application andSHIFT+Application. These key combinations are reserved for applications to support. Support for Windows+Application is reserved for the operating system.Suggestions for Support of Application Key Combinations Context menu at the location of the text cursor (instead of the mouse pointer)Launch automated help agentPop up list of last 5 actions (or list of commonly accessed functions)Enable/Disable macro recording or other user controllable featuresSwitch to next open window in a multiple documentUser assignable key through an application UIApplication Key Support in the Microsoft Windows Operating Systems The application key will primarily function to bring up a context menu at the selection or mouse pointer. This functionality is the same as the right mouse button click in some applications today.Application Key Response Supported by the Operating System Operating SystemWindows 3.x no response1Windows NT 3.5x no response1Windows NT 4.0 context menu on selectionWindows NT 4.0 context menu on selectionWindows 95 context menu on selectionWindows 98 context menu on selectionWindows still reports a 5D virtual key code which means that applications can enable functionalityUsing the Windows Logo Key Logo and Application Key Logo in DocumentationThe Windows Logo key and the Application Logo key may be used by OEMs, ISVs and IHVs in documentation that describes the functionality of the Logo keys, provided such description is consistent with Microsoft’s guidelines for use of the Logo keys.•It is not necessary to obtain a Logo license from Microsoft in order to refer to the Logo keys in documentation. This is the only permissible non-licensed use of the Windows Logo.•The Logos may not be used in any way other than as specified in the Logo license guidelines. •Upon request, Microsoft will provide camera-ready artwork of the Logos to be used in documentation. Send your e-mail request to Microsoft Windows Hardware Quality Labs at**********************with “Artwork Request” in your subject line. Alternativel y, you may use the Windows flag symbol provided in the “Wingdings®” font. This character is available by pressing ALT + 0255 on the numeric keypad.•You may not alter the Logos in any way.•The Logos should be typed with an empty space before and after each symbol, followed by a plus sign and another space, followed by the modifier if appropriate. Examples are shown:Windows Logo key + B or + BApplication key + S or + + SWindows Logo Key Support (Reserved for Operating System Use)The Windows Logo keys are reserved for system level functions. Software developers should not implement support for the Windows Logo keys in Windows 95, Windows 98, or Windows NT-based applications. The Windows Logo keys are supported in the operating system and provide system level functionality to the end user. The following table lists a few of the Windows Logo key combinations and their functionality. This list is not exhaustive and additional combinations will be used by the Microsoft Windows 95, Windows 98, or Windows NT operating systems.Windows Keys Support for OEMs and Keyboard IHVs OEMs that buy their keyboards with Windows Logo keys from a licensed keyboard manufacturer and do not modify the keyboard product except to add their Logo and other cosmetic changes are not required to license the Windows Logo keys from Microsoft. If the OEM product changes the layout or BIOS of an already licensed keyboard the OEM must go through the same licensing and certification procedure as described in the next section of this document.Software Support of the Windows Keys in the Windows 95/98 Operating SystemThe Windows Keys are supported in the Windows 95, Windows 98, or Windows NT operating systems user interface. Application vendors will enable functionality for the Application key in their applications. 10 Windows Logo key combinations are reserved for OEM use.Special Keys Reserved for OEM UsageTen (10) Windows Logo keys combinations have been reserved for OEM use. These keys can be used by OEMs to provide keyboard hotkey controls for Speaker Volume, Monitor/LCD Brightness or Contrast, Password, or other value added functions.Multiple Key Operation RequirementsValid 2-Key CombinationsThe following list combined with the “Valid Final Keys” table, defines th e valid 2-key combinations. When any one of the keys below is pressed, followed by a 2nd key from the “Valid Final Keys” table, the keyboard must properly indicate that those 2 keys are pressed. There are no exceptions to these 2-Key Combinations.•LWIN•RWIN•LCTRL•RCTRL•LSHIFT•RSHIFT•LALT•RALTValid Final KeysThe following table lists the final keys that are required to work for valid two and three key combinations. Any key from the Valid 2-Key Combinations list combined with any key from the table below must work properly. Any 2 keys indicated in a row from the Valid 3-Key Combinations table combined with any key from the table below must work properly. Exceptions to this requirement are listed in Combinations of 3-Keys which are unavailable. Invalid key combinations will generate a Key Error code.Indicates Traditional IBM Final keys.Valid 3-Key CombinationsThe following table combined with the “Valid Final Keys” table, defines the valid 3-key combinations. For each row in the table below, an “X” indicates that key is selected. When the two keys in a row are pressed followed by a 3rd key from the “Valid Final Keys” table, the keyboard must properly indicate that those 3 keys are pressed. Exceptions to these tables are listed below. Any 3-key combinations not listed are not required to work, but ma y do so at the keyboard manufacturer’s discretion.Indicates Traditional IBM 3-Key combinations.Combinations of 3-Keys which are UnavailableBased upon the s tandard industry accepted 16 X 8 scanning matrix, several keys will be “ghosted”, meaning not uniquely detectable by the firmware during the key switch scanning of 3-Key combinations. To accommodate this, the following table details the key combinations, which are excluded from the above tables. These 3-key combinations are not required to work, but may do so at the keyboard manufacturer’s discretion.Additional General RequirementsLWIN and RWIN Keys as modifiersThis keyboard must generate unique scan codes for make and break. The LWIN and RWIN keys must be treated as modifier keys, much in the same way as ALT, and Control keys are handled today. It will be up to the operating system to decide on an implementation scheme for the modifier key functionality.Building a Keyboard with the Windows KeysTools Needed to Build a Keyboard with the Windows Keys •Keyboard Scan Code Specification (this document).•Microsoft Windows Logo License Agreement•Windows Logo Key License Agreement.•Windows Exhibit A from the Device Testing Agreement.•Windows Exhibit B from the “Designed for Microsoft” Logo License Agreement.•Windows Keyboard Test Kit: Test Procedures and Test Tools.How to Get the WHQL Keyboard Test Kit and Keys SpecificationThe latest version of the Keyboard Scan Code Specification is available at/hwdev/desinit/scancode.htm.The latest version of the WHQL Keyboard Test Kit is available electronically directly from the Windows Hardware Quality Labs Web Site at /hwtest/testkits/. You will need to individually download the Test Procedures and Test Tools document.Microsoft Windows Legal AgreementsComplete and sign the Microsoft Logo License Agreement and the Testing Agreement. If your company previously signed these agreements, you only need to include a newly completed “Exhibit A” of the Testing Agreement with your Test Submission.Note: The following WHQL legal agreements, previously available through the Microsoft FAX Service, can now be downloaded from the WHQL web site at /hwtest/testkits/ :•Microsoft Windows Logo License Agreement - "Exhibit A5" (Windows Logo Agreement.tif) •Testing Agreement (Testing Agreement.tif)•"Exhibit A" of the Testing Agreement (Exhibit A.tif)If you are unable to open these agreements, please send e-mail to ********************** with AGREEMENT REQUEST in the Subject line.Send blank e-mail to the auto reply at ********************** for a complete list of administrative contacts.Steps to Ship a Keyboard with the Windows Logo KeysDevelop your keyboard according to the tables in Appendix A of this specification. Compatibility Requirement1. Keyboards are required to be compatible at the Windows virtual key code level. You can accomplish this by either:a) Developing a keyboard with the electronics and firmware that comply with thespecification or by,b) Developing a software driver for use with Windows 3.1 and Windows 95 that maps theproper virtual key codes to keyboard events on your keyboard.2. Test your implementation using the WHQL Keyboard Test Procedures to ensure that single-key,two-key and three-key combinations work correctly, including the Windows Logo keys (ifimplemented) and report the proper virtual scan codes in Windows.3. Once you are satisfied that your keyboard passes the tests, run the full Test Suite and use it togenerate log files of encoded test results that must be included with the other information required for your Test Submission. Full testing instructions are provided in the WHQL Keyboard TestProcedures.Retest RequirementsAny time that you implement the Windows Keys on a new keyboard technology, you must go through this testing and certification procedure. You will also need to submit a retest any time that you change the key layout or the BIOS firmware on a certified keyboard.Recommended Physical Locations of the Windows KeysFor full travel desktop keyboards Microsoft recommends that the Windows Logo keys be located near the current modifier keys like CTRL, SHIFT and ALT since the Windows Logo keys must also function as modifier keys. The Application key can be located wherever it appropriately fits. In the attached diagram the keys were placed on the bottom row on either side of the space bar. By changing the current size of the space bar the Windows Keys can be located in a similar position on a standard keyboard.Recommendations for Laptop KeyboardsGiven the crowded nature of laptop keyboards it is difficult to add three Windows Keys. A minimal implementation of the Windows Keys would require the addition of one Windows Logo Key and the replacement of the [Fn] key for the Application key.The two Windows Logo Keys are not distinguished individually by the Microsoft Windows 95 operating system and the IntelliType software only uses a Left Windows Logo key + Right Windows Logo key press for the Logon/Logoff function.Design Requirements:•The Windows Logo Key needs to function as a modifier key (CTRL, SHIFT and ALT).•There can be no other icons or words associated with the Windows Flag trademark on the keycap. Design Options:•There do not need to be Left and Right Windows Logo keys to get full functionality in Windows 95. •The Application key can be a dual function key and can be used to replace the Fn. key.ACPI Power Management KeysThe three ACPI Power Management keys report the following key codes in the Microsoft Windows 95, Windows 98, and Windows NT and operating systems.Key Codes for Scan Code Set 1:ACPI key Make Break Windows Virtual KeyPower Event E0 5E E0 DE N/ASleep Event E0 5F E0 DF N/AWake Event E0 63E0 E3N/AKey Codes For Scan Code Set 2:ACPI key Make Break Windows Virtual KeyPower Event E0 37 E0 F0 37 N/ASleep Event E0 3F E0 F0 3F N/AKey Codes for USB Usage Tables:Usage Page and Usages for Audio ControlA device wanting to be to recognized as a HID audio control device must declare itself as being a Consumer Control device (usage 0x01), as defined in the Consumer Page (page 0x0C) in the Universal Serial Bus HID Usage Tables Version 1.0 specification. This means that its top-level application collection should be Usage Page (Consumer), Usage (Consumer Control). When such a device is enumerated by the operating system, the supporting software (HIDSERVE.EXE) is installed and loaded on the host system. Table 1 outlines the Consumer Page audio controls that are supported in Windows 2000.Table 1. Consumer Page audio controls supported in Windows 2000.Usage Usage Name Usage Type0xE0 Volume* Linear Control (LC)0xE2 Mute* On/Off Control (OOC)0xE3 Bass Linear Control (LC)0xE4 Treble Linear Control (LC)0xE5 Bass Boost* On/Off Control (OOC)0xE7 Loudness On/Off Control (OOC)0xE9 Volume Increment* Re-trigger Control (RTC)0xEA Volume Decrement* Re-trigger Control (RTC)0x152 Bass Increment Re-trigger Control (RTC)0x153 Bass Decrement Re-trigger Control (RTC)0x154 Treble Increment Re-trigger Control (RTC)0x155 Treble Decrement Re-trigger Control (RTC)*) These controls are supported in Windows 98 (original release and Service Pack 1 release).The Volume, Bass, and Treble usages (of type LC) should be deployed for controls that generate both increment and decrement data represented by a 2-bit value, whereas the associated Increment and Decrement usages (of type RTC) should be deployed for pairs of one-bit controls (traditional button controls). The hardware design and implementation determines what usage types are appropriate for the HID firmware implementation for a particular device.It's also important to notice that any re-triggering of events should be done by software timers in the host system, and not by hardware timers in the device itself. For example, if the user keeps pressing the Volume Increment button, the device should only generate one input report with this state information. Host software will perform the actual re-triggering of events that will lead to continuous increments of the volume until the device generates another input report indicating that the button has been released or until the maximum volume has been reached.Important Design AspectsThe supported HID audio controls:•Affect audio playback only. There's no support for HID-based controls that affect audio recording, etc.•Affect audio playback by the default system audio device (same device as sndvol32.exe controls). •Should be declared right beneath the top-level application collection in the HID firmware in order to be discovered and utilized by the host system. Important: do not wrap these controls in sub-collections.Sample Firmware DesignsThe following two samples illustrate how firmware that uses the audio controls listed above can be implemented. The first sample uses the Volume usage (of type LC) for the volume control, and the second sample uses the Volume Increment and Volume Decrement usages (of type RTC). Notice that the mute button in both of these samples is implemented as a Relative, Preferred State type of control, or a toggle, which means that 0-to-1 transitions will toggle mute on/off.Sample 1.Usage Page (Consumer)Usage (Consumer Control)Collection (Application)Usage (Volume)Logical Minimum (-1)Logical Maximum (1)Report Size (2)Report Count (1)Input (Data, Variable, Relative, Preferred)Usage (Mute)Logical Minimum (0)Logical Maximum (1)Report Size (1)Report Count (1)Input (Data, Variable, Relative, Preferred)Report Count (5)Input (Constant)End CollectionSample 2.Usage Page (Consumer)Usage (Consumer Control)Collection (Application)Logical Minimum (0)Logical Maximum (1)Usage (Volume Increment)Usage (Volume Decrement)Report Size (1)Report Count (2)Input (Data, Variable, Absolute, Preferred)Usage (Mute)Report Count (1)Input (Data, Variable, Relative, Preferred)Report Count (5)Input (Constant)End CollectionAppendix A: Windows Standard PS/2 Scan Codes General RequirementsThis keyboard must be downward compatible with an enhanced type 101 keyboard. This keyboard must be fully compatible with the PS/2 Keyboard Controller command set. It must support Scan Set 2. Three additional scan codes are to be generated from the three Windows Keys (Left Windows, Right Windows, and Application).The virtual key codes described in the following tables are specifically for Windows operation only and are not generated by the keyboard directly. The keyboard manufacturer will need to provide a Windows Logo keyboard driver to support the three virtual keys for use with the Windows v. 3.1 operating system (not required for Logo purposes). The support will be built into drivers shipped with future versions of the Windows and Windows NT operating systems.Typematic CharacteristicsTypematic is the term used for keys that will automatically repeat after a specified time delay. In scan code 1 and scan code 2, key 126 is the only key that is not Typematic. (This key is the only one that does not send a break code as well).Scan Code Assignments:Under all Microsoft operating systems, all keyboards actually transmit Scan Code Set 2 values down the wire from the keyboard to the keyboard port. These values are translated to Scan Code Set 1 by the i8042 port chip.1 The rest of the operating system, and all applications that handle scan codes expect the values to be from Scan Code Set 1. Scan Code Set 3 is not used or required for operation of Microsoft operating systems.The following recommendations are made for those who wish to define a new scan code for a proprietary purpose. It is the manufacturer’s responsibility to implement a software driver that supports any such scan codes. New scan codes must not be chosen from those currently recognized by the operating system. Keys that are called out with a Key Number or Key Name in the Scan Code Table are currently recognized by and used by the operating system.Single-Byte Scan CodesThe values discussed below are all Scan Code Set 1 values.Avoid Set 1 scan codes above 0x79, since the release (key up) code would be 0xFA or greater, and the keyboard driver is known to interpret such values as responses from the 8042 chip, not as keystrokes (scan codes). Specifically, 0x7A, 0x7E and 0x7F are problematic for the Windows NT keyboard driver in 3.51 and 4.0 since 0xFE is RESEND, 0xFA. is ACKNOWLEDGE and 0xFF seems to be simply just swallowed up. The effect is that key releases would be lost, and error logs fill up.1 This mode is set by issuing a 0xF0 command byte to the keyboard, and turning the translate bit(0x40) in the 8042 command byte on. On Intel and Power PC machines, it is the firmware that initializes the keyboard and 8042 chip this way, while Windows NT® explicitly sets this mode for MIPS and Alpha.In the very early days of Windows NT®, an attempt was made to use the much more orthogonal Scan Code Set 3, but due to bugs in the implementation of this Scan Code Set on numerous OEM keyboards, the idea was abandoned.•Avoid 0x60 and 0x61, since the release (up key) code would be 0xE0 and 0xE1, which are reserved prefix bytes.•Avoid 0x00, since that is likely to have some special meaning to code from driver level through to application level.Prefixed Scan CodesSome keys on standard 101/102-key keyboards (and the Microsoft Natural keyboard amongst others) emit a sequence of two bytes, where the 1st byte is either 0xE0 or 0xE1. This method is used primarily to distinguish between left and right versions of the same key, e.g., Left Alt is 0x38 while Right Alt is0xE0 0x38. The 0xE0 prefix is indicated as th e “extended bit” (bit 24) in the lParam of messages such as WM_KEYDOWN. The 0xE1 prefix is much rarer, but operates similarly to the 0xE0 prefix. It’s presence or absence is not indicated through the API in any way.If you use scan codes from the 0xE0 set, make sure the second byte is suitable in the same way as single byte scan code values. In other words:Not greater than 0x79Not 0x60 or 0x61Not 0x00Scan Code TableThe following table lists the full set of Scan Codes as presently recognized by the Microsoft operating systems. The US Key assignments are for reference to a type 101/102 Enhanced keyboard as supported by the Type 4 Keyboard layout. If there is no entry in the 101/102 Enhanced keyboard column, this scan code is currently not recognized by the operating system. The Key Location field has been added to aid in the placement of keys as illustrated in theRecommended Physical Locations of the Windows Keys on page 10.Note * Key 29 is available on the US and not on the International Keyboard.Note ** Keys 42 and 45 are available on the International Keyboard and not on the US Keyboard.Note *** Keys 56 and 107 are used on Brazilian and some Far East keyboards. They not available on US Keyboards.Note ‡Keys are used for Far East keyboards.Note 1 for Scan Code 1:These keys may have additional “shift” and/or “unshift” scan codes preceding the Base Make code and following the Base Break code, depending upon the current state of Num Lock and the state of Shift key/s (when multiple keys are held down at the same time).These Keys are Typematic:。
计算机基础知识键盘功能的应用
计算机基础知识键盘功能的应用1.我正在用键盘打字。
I am typing on the keyboard.2.键盘上有数字、字母和符号键。
The keyboard has number, letter, and symbol keys.3.我用键盘输入密码。
I enter my password using the keyboard.4.我按下空格键。
I press the space bar key.5.在键盘上按住Shift键可以输入大写字母。
Holding down the Shift key on the keyboard allows me to type uppercase letters.6.我用键盘上的方向键来移动光标。
I use the arrow keys on the keyboard to move the cursor.7.我按下回车键确认输入。
I press the Enter key to confirm the input.8.我使用键盘上的Ctrl键组合快捷键。
I use the Ctrl key on the keyboard to execute shortcut commands.9.我用键盘上的删除键删除错误的文字。
I use the delete key on the keyboard to erase incorrect text.10.我正在给键盘清洁。
I am cleaning the keyboard.11.我用键盘敲击节奏来演奏音乐。
I play music by tapping the keys in a rhythmic pattern on the keyboard.12.我用键盘输入网址。
I type in the website address using the keyboard.13.我在键盘上输入电子邮件。
I input emails on the keyboard.14.按下Caps Lock键可以切换大写和小写字母。
键盘鼠标报告描述符解释
键盘鼠标报告描述符解释code char KeyBoardReportDescriptor[63] = {//表示用途页为通用桌面设备0x05, 0x01, // USAGE_PAGE (Generic Desktop)//表示用途为键盘0x09, 0x06, // USAGE (Keyboard)//表示应用集合,必须要以END_COLLECTION来结束它,见最后的END_COLLECTION0xa1, 0x01, // COLLECTION (Application)//表示用途页为按键0x05, 0x07, // USAGE_PAGE (Keyboard)//用途最小值,这里为左ctrl键0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)//用途最大值,这里为右GUI键,即window键0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)//逻辑最小值为00x15, 0x00, // LOGICAL_MINIMUM (0)//逻辑最大值为10x25, 0x01, // LOGICAL_MAXIMUM (1)//报告大小(即这个字段的宽度)为1bit,所以前面的逻辑最小值为0,逻辑最大值为10x75, 0x01, // REPORT_SIZE (1)//报告的个数为8,即总共有8个bits0x95, 0x08, // REPORT_COUNT (8)//输入用,变量,值,绝对值。
像键盘这类一般报告绝对值,//而鼠标移动这样的则报告相对值,表示鼠标移动多少0x81, 0x02, // INPUT (Data,Var,Abs)//上面这这几项描述了一个输入用的字段,总共为8个bits,每个bit表示一个按键//分别从左ctrl键到右GUI键。
这8个bits刚好构成一个字节,它位于报告的第一个字节。
键盘code
event.keycode值大全1 keycode 8 = BackSpace BackSpace2 keycode 9 = Tab Tab3 keycode 12 = Clear4 keycode 13 = Enter5 keycode 16 = Shift_L6 keycode 17 = Control_L7 keycode 18 = Alt_L8 keycode 19 = Pause9 keycode 20 = Caps_Lock10 keycode 27 = Escape Escape11 keycode 32 = space space12 keycode 33 = Prior13 keycode 34 = Next14 keycode 35 = End15 keycode 36 = Home16 keycode 37 = Left17 keycode 38 = Up18 keycode 39 = Right19 keycode 40 = Down20 keycode 41 = Select21 keycode 42 = Print22 keycode 43 = Execute23 keycode 45 = Insert24 keycode 46 = Delete25 keycode 47 = Help26 keycode 48 = 0 equal braceright27 keycode 49 = 1 exclam onesuperior28 keycode 50 = 2 quotedbl twosuperior29 keycode 51 = 3 section threesuperior30 keycode 52 = 4 dollar31 keycode 53 = 5 percent32 keycode 54 = 6 ampersand33 keycode 55 = 7 slash braceleft34 keycode 56 = 8 parenleft bracketleft35 keycode 57 = 9 parenright bracketright36 keycode 65 = a A37 keycode 66 = b B38 keycode 67 = c C39 keycode 68 = d D40 keycode 69 = e E EuroSign41 keycode 70 = f F4243 keycode 71 = g G45 keycode 73 = i I46 keycode 74 = j J47 keycode 75 = k K48 keycode 76 = l L49 keycode 77 = m M mu50 keycode 78 = n N51 keycode 79 = o O52 keycode 80 = p P53 keycode 81 = q Q at54 keycode 82 = r R55 keycode 83 = s S56 keycode 84 = t T57 keycode 85 = u U58 keycode 86 = v V59 keycode 87 = w W60 keycode 88 = x X61 keycode 89 = y Y62 keycode 90 = z Z63 keycode 96 = KP_0 KP_064 keycode 97 = KP_1 KP_165 keycode 98 = KP_2 KP_266 keycode 99 = KP_3 KP_367 keycode 100 = KP_4 KP_468 keycode 101 = KP_5 KP_569 keycode 102 = KP_6 KP_670 keycode 103 = KP_7 KP_771 keycode 104 = KP_8 KP_872 keycode 105 = KP_9 KP_973 keycode 106 = KP_Multiply KP_Multiply74 keycode 107 = KP_Add KP_Add7576 keycode 108 = KP_Separator KP_Separator77 keycode 109 = KP_Subtract KP_Subtract78 keycode 110 = KP_Decimal KP_Decimal79 keycode 111 = KP_Divide KP_Divide80 keycode 112 = F181 keycode 113 = F282 keycode 114 = F383 keycode 115 = F4848586 keycode 116 = F587 keycode 117 = F689 keycode 119 = F890 keycode 120 = F991 keycode 121 = F1092 keycode 122 = F1193 keycode 123 = F1294 keycode 124 = F1395 keycode 125 = F1496 keycode 126 = F1597 keycode 127 = F1698 keycode 128 = F1799 keycode 129 = F18100 keycode 130 = F19101 keycode 131 = F20102 keycode 132 = F21103 keycode 133 = F22104 keycode 134 = F23105 keycode 135 = F24106 keycode 136 = Num_Lock107 keycode 137 = Scroll_Lock108 keycode 187 = acute grave109 keycode 188 = comma semicolon110 keycode 189 = minus underscore111 keycode 190 = period colon112 keycode 192 = numbersign apostrophe113 keycode 210 = plusminus hyphen macron114 keycode 211 =115 keycode 212 = copyright registered116 keycode 213 = guillemotleft guillemotright 117 keycode 214 = masculine ordfeminine118 keycode 215 = ae AE119 keycode 216 = cent yen120 keycode 217 = questiondown exclamdown 121 keycode 218 = onequarter onehalf threequarters 122 keycode 220 = less greater bar123 keycode 221 = plus asterisk asciitilde124 keycode 227 = multiply division125126 keycode 228 = acircumflex Acircumflex127 keycode 229 = ecircumflex Ecircumflex128 keycode 230 = icircumflex Icircumflex129 keycode 231 = ocircumflex Ocircumflex130 keycode 232 = ucircumflex Ucircumflex131 keycode 233 = ntilde Ntilde132 keycode 234 = yacute Yacute133 keycode 235 = oslash Ooblique134 keycode 236 = aring Aring135 keycode 237 = ccedilla Ccedilla136 keycode 238 = thorn THORN137 keycode 239 = eth ETH138 keycode 240 = diaeresis cedilla currency 139 keycode 241 = agrave Agrave atilde Atilde 140 keycode 242 = egrave Egrave141 keycode 243 = igrave Igrave142 keycode 244 = ograve Ograve otilde Otilde 143 keycode 245 = ugrave Ugrave144 keycode 246 = adiaeresis Adiaeresis145 keycode 247 = ediaeresis Ediaeresis146 keycode 248 = idiaeresis Idiaeresis147 keycode 249 = odiaeresis Odiaeresis148 keycode 250 = udiaeresis Udiaeresis149 keycode 251 = ssharp question backslash 150 keycode 252 = asciicircum degree151 keycode 253 = 3 sterling152 keycode 254 = Mode_switch。
Android Kecode对照表
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
KEYCODE_SPACE
空格键
小键盘
KEYCODE_NUMPAD_0 KEYCODE_NUMPAD_1 KEYCODE_NUMPAD_2 KEYCODE_NUMPAD_3 KEYCODE_NUMPAD_4 KEYCODE_NUMPAD_5 KEYCODE_NUMPAD_6 KEYCODE_NUMPAD_7 KEYCODE_NUMPAD_8 KEYCODE_NUMPAD_9 KEYCODE_NUMPAD_ADD KEYCODE_NUMPAD_SUBTRACT KEYCODE_NUMPAD_MULTIPLY KEYCODE_NUMPAD_DIVIDE KEYCODE_NUMPAD_EQUALS KEYCODE_NUMPAD_COMMA KEYCODE_NUMPAD_DOT KEYCODE_NUMPAD_LEFT_PAREN KEYCODE_NUMPAD_RIGHT_PAREN KEYCODE_NUMPAD_ENTER 小键盘按键'0' 小键盘按键'1' 小键盘按键'2' 小键盘按键'3' 小键盘按键'4' 小键盘按键'5' 小键盘按键'6' 小键盘按键'7' 小键盘按键'8' 小键盘按键'9' 小键盘按键'+' 小键盘按键'-' 小键盘按键'*' 小键盘按键'/' 小键盘按键'=' 小键盘按键',' 小键盘按键'.' 小键盘按键'(' 小键盘按键')' 小键盘按键回车
C#键盘功能代码
C#键盘功能代码#region 屏蔽Windows功能键(快捷键)public delegate int HookProc(int nCode, int wParam, IntPtr lParam);private static int hHook = 0;public const int WH_KEYBOARD_LL = 13;//LowLevel键盘截获,如果是WH_KEYBOARD=2,并不能对系统键盘截取,会在你截取之前获得键盘。
private static HookProc KeyBoardHookProcedure;//键盘Hook结构函数[StructLayout(LayoutKind.Sequential)]public class KeyBoardHookStruct{public int vkCode;public int scanCode;public int flags;public int time;public int dwExtraInfo;}//设置钩子[DllImport("user32.dll")]public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]//抽掉钩子public static extern bool UnhookWindowsHookEx(int idHook);[DllImport("user32.dll")]//调用下一个钩子public static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);[DllImport("kernel32.dll")]public static extern int GetCurrentThreadId();[DllImport("kernel32.dll")]public static extern IntPtr GetModuleHandle(string name);public static void Hook_Start(){// 安装键盘钩子if (hHook == 0){KeyBoardHookProcedure = new HookProc(KeyBoardHookProc);hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyBoardHookProcedure,GetModuleHandle(Process.GetCurrentProcess().MainModul e.ModuleName), 0);//如果设置钩子失败.if (hHook == 0){Hook_Clear();}}}//取消钩子事件public static void Hook_Clear(){bool retKeyboard = true;if (hHook != 0){retKeyboard = UnhookWindowsHookEx(hHook);hHook = 0;}//如果去掉钩子失败.if (!retKeyboard) throw new Exception("Hook去除失败");}//这里可以添加自己想要的信息处理private static int KeyBoardHookProc(int nCode, int wParam, IntPtr lParam){if (nCode >= 0){KeyBoardHookStruct kbh = (KeyBoardHookStruct)Marshal.PtrToStructure(lParam,typeof(KeyBoardHookStruct));if (kbh.vkCode == 91) // 截获左win(开始菜单键){return 1;}if (kbh.vkCode == 92)// 截获右win(开始菜单键){return 1;}if (kbh.vkCode == (int)Keys.Escape && (int)Control.ModifierKeys == (int)Keys.Control) //截获Ctrl+Esc {return 1;if (kbh.vkCode == (int)Keys.Escape && (int)Control.ModifierKeys == (int)Keys.Alt) //截获Alt+Esc {return 1;}if (kbh.vkCode == (int)Keys.F4 && (int)Control.ModifierKeys == (int)Keys.Alt) //截获alt+f4{return 1;}if (kbh.vkCode == (int)Keys.Tab && (int)Control.ModifierKeys == (int)Keys.Alt) //截获alt+tab {return 1;}if (kbh.vkCode == (int)Keys.Escape && (int)Control.ModifierKeys == (int)Keys.Control + (int)Keys.Shift) //截获Ctrl+Shift+Esc{return 1;}if (kbh.vkCode == (int)Keys.Space && (int)Control.ModifierKeys == (int)Keys.Alt) //截获alt+空格{return 1;}if (kbh.vkCode == 241) //截获F1{return 1;if ((int)Control.ModifierKeys == (int)Keys.Control + (int)Keys.Alt + (int)Keys.Delete) //截获Ctrl+Alt+Delete {return 1;}if ((int)Control.ModifierKeys == (int)Keys.Control + (int)Keys.Shift) //截获Ctrl+Shift{return 1;}if (kbh.vkCode == (int)Keys.Space && (int)Control.ModifierKeys == (int)Keys.Control + (int)Keys.Alt) //截获Ctrl+Alt+空格{return 1;}}return CallNextHookEx(hHook, nCode, wParam, lParam);}////// 开打任务管理器快捷键为Windows底层按键//////public static void T askMgrLocking(bool bLock){if (bLock)//屏蔽任务管理器、并且不出现windows提示信息“任务管理器已被管理员禁用”{Process p = new Process();p.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);p.StartInfo.FileName = "taskmgr.exe";p.StartInfo.CreateNoWindow = true;p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;p.Start();}else//设置任务管理器为可启动状态{Process[] p = Process.GetProcesses();foreach (Process p1 in p){try{if (p1.ProcessName.ToLower().Trim() == "taskmgr")//这里判断是任务管理器{p1.Kill();RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\\\Microsoft\\\\Wi ndows\\\\CurrentVersion\\\\Policies\\\\S ystem", true);r.SetValue("DisableTaskmgr", "0"); //设置任务管理器为可启动状态Registry.CurrentUser.DeleteSubKey("Software\\\\Microsoft\\ \\Windows\\\\CurrentVersion\\\\Policies\\\\ System");}}catch{return;}}}}#endregion//调用private void button1_Click(object sender, EventArgs e){//启动钩子,处理钩子事件Hook_Start();//屏蔽任务管理器TaskMgrLocking(true);}////// 关闭窗口时事件///private void Form1_FormClosing(object sender, FormClosingEventArgs e){ //注销Id号为100的热键设定UnregisterHotKey(Handle, 100); //注销Id号为101的热键设定UnregisterHotKey(Handle, 101); //注销Id号为102的热键设定UnregisterHotKey(Handle, 102); //注销Id号为103的热键设定UnregisterHotKey(Handle, 103);Hook_Clear();TaskMgrLocking(false); }。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
VK_LSHIFT
0xA0
Left SHIFT key
VK_RSHIFT
0xA1
Right SHIFT key
VK_LCONTROL
0xA2
Left CONTROL key
VK_RCONTROL
0xA3
Right CONTROL key
VK_LMENU
0xA4
Left MENU key
0x6B
Add key
VK_SEPARATOR
0x6C
Separator key
VK_SUBTRACT
0x6D
Subtract key
VK_DECIMAL
0x6E
Decimal key
VK_DIVIDE
0x6F
Divide key
VK_F1
0x70
F1 key
VK_F2
0x71
F2 key
VK_F3
0x2E
DEL key
VK_HELP
0x2F
HELP key
0x30
0 key
0x31
1 key
0x32
2 key
0x33
3 key
0x34
4 key
0x35
5 key
0x36
6 key
0x37
7 key
0x38
8 key
0x39
9 key
-
0x3A-40
Undefined
0x41
A key
0x42
Right mouse button
VK_CANCEL
0x03
Control-break processing
VK_MBUTTON
0x04
Middle mouse button (three-button mouse)
VK_XBUTTON1
0x05
X1 mouse button
VK_XBUTTON2
VK_RMENU
0xA5
Right MENU key
VK_BROWSER_BACK
0xA6
Browser Back key
VK_BROWSER_FORWARD
0xA7
Browser Forward key
VK_BROWSER_REFRESH
0xA8
Browser Refresh key
VK_BROWSER_STOP
0xDC
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the '\|' key
VK_OEM_6
0xDD
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the '/?' key
VK_OEM_3
0xC0
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the '`~' key
Numeric keypad 6 key
VK_NUMPAD7
0x67
Numeric keypad 7 key
VK_NUMPAD8
0x68
Numeric keypad 8 key
VK_NUMPAD9
0x69
Numeric keypad 9 key
VK_MULTIPLY
0x6A
Multiply key
VK_ADD
VK_HANGUL
0x15
IME Hangul mode
-
0x16
Undefined
VK_JUNJA
0x17
IMEJunjamode
VK_FINAL
0x18
IME final mode
VK_HANJA
0x19
IME Hanja mode
VK_KANJI
0x19
IME Kanji mode
-
0x1A
Undefined
0xA9
Browser Stop key
VK_BROWSER_SEARCH
0xAA
Browser Search key
VK_BROWSER_FAVORITES
0xAB
Browser Favorites key
VK_BROWSER_HOME
0xAC
Browser Start and Home key
VK_VOLUME_MUTE
VK_MEDIA_STOP
0xB2AY_PAUSE
0xB3
Play/Pause Media key
VK_LAUNCH_MAIL
0xB4
Start Mail key
VK_LAUNCH_MEDIA_SELECT
0xB5
Select Media key
VK_LAUNCH_APP1
For the US standard keyboard, the ']}' key
VK_OEM_7
0xDE
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the 'single-quote/double-quote' key
0xAD
Volume Mute key
VK_VOLUME_DOWN
0xAE
Volume Down key
VK_VOLUME_UP
0xAF
Volume Up key
VK_MEDIA_NEXT_TRACK
0xB0
Next Track key
VK_MEDIA_PREV_TRACK
0xB1
Previous Track key
VK_SHIFT
0x10
SHIFT key
VK_CONTROL
0x11
CTRL key
VK_MENU
0x12
ALT key
VK_PAUSE
0x13
PAUSE key
VK_CAPITAL
0x14
CAPS LOCK key
VK_KANA
0x15
IME Kana mode
VK_HANGUEL
0x15
IMEHanguelmode (maintained for compatibility;useVK_HANGUL)
VK_NUMPAD2
0x62
Numeric keypad 2 key
VK_NUMPAD3
0x63
Numeric keypad 3 key
VK_NUMPAD4
0x64
Numeric keypad 4 key
VK_NUMPAD5
0x65
Numeric keypad 5 key
VK_NUMPAD6
0x66
0x06
X2 mouse button
-
0x07
Undefined
VK_BACK
0x08
BACKSPACE key
VK_TAB
0x09
TAB key
-
0x0A-0B
Reserved
VK_CLEAR
0x0C
CLEAR key
VK_RETURN
0x0D
ENTER key
-
0x0E-0F
Undefined
0xB6
Start Application 1 key
VK_LAUNCH_APP2
0xB7
Start Application 2 key
-
0xB8-B9
Reserved
VK_OEM_1
0xBA
Used for miscellaneous characters; it can vary by keyboard.
VK_F22
0x85
F22 key
VK_F23
0x86
F23 key
VK_F24
0x87
F24 key
-
0x88-8F
Unassigned
VK_NUMLOCK
0x90
NUM LOCK key
VK_SCROLL
0x91
SCROLL LOCK key
0x92-96
OEM specific
-
0x97-9F
-
0xC1-D7
Reserved
-
0xD8-DA
Unassigned
VK_OEM_4
0xDB
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the '[{' key
VK_OEM_5
Constant/value
Description
Sample:
#include<Windows.h>
Keybd_event(0xb5,0,0,0);//按下Keybd_event(0xb5,0,2,0);//松开
VK_LBUTTON
0x01
Left mouse button
VK_RBUTTON
0x02