键盘扫描码key_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系统中,这个组合键还有其他作用,比如打开安全选项等。
键盘扫描码——精选推荐
键盘扫描码
键盘上除了ASCII码外,还有非ASCII码(如左移键“←”对应的编码),叫扩充键盘码。
我们把扩充键盘码放在高八位,ASC II码放在低八位所组成的代码称为扫描码。
对于某一特定的扫描码,若其低8位不为零,则此8位就是相应字符的ASCII码值;若低8位是零,则高8位是扩充键盘码,需要再读取人第二个字节,根据它的值来判断它是那一个功能键。
下表给出了单功能键和组合功能键的键值,表中代码系指第二个字节键值的十进制数。
例如,“←”的扫描码低8位应为零,而高8位是0x4b,所以,“←”键的扫描码为O x4b00;而“回车键”有对应的ASCII码,故其扫描码的低8位是回车键的ASCII码值0xod。
测试键盘扫描码
调用标准库函数b ioskey()读取键盘扫描码。
注意要使用b io skey()函数,应在文件头部加上#includ e “b ios.h”。
函数b io skey()的功能是用于识别用户按键和获得按键值。
函数原
型是:
int b ioskey(int cmd);
在<b ios.h>中定义,在使用它时,应用include命令将b ios.h文件包含进来。
其中参数cmd可取值0或1。
①当cmd=1时,检测键盘是否有击键,如果没有击键,函数将返回0,否则返回非零;
②当cmd=0时,返回从键盘输入的扫描码。
语句key=b ioskey(0);读取键盘输入的扫描码,并存储在变量k ey 中。
键盘扫描码
键盘扫描码
键盘上除了ASCII码外,还有非ASCII码(如左移键“←”对应的编码),叫扩充键盘码。
我们把扩充键盘码放在高八位,ASC II码放在低八位所组成的代码称为扫描码。
对于某一特定的扫描码,若其低8位不为零,则此8位就是相应字符的ASCII码值;若低8位是零,则高8位是扩充键盘码,需要再读取人第二个字节,根据它的值来判断它是那一个功能键。
下表给出了单功能键和组合功能键的键值,表中代码系指第二个字节键值的十进制数。
例如,“←”的扫描码低8位应为零,而高8位是0x4b,所以,“←”键的扫描码为O x4b00;而“回车键”有对应的ASCII码,故其扫描码的低8位是回车键的ASCII码值0xod。
测试键盘扫描码
调用标准库函数b ioskey()读取键盘扫描码。
注意要使用b io skey()函数,应在文件头部加上#includ e “b ios.h”。
函数b io skey()的功能是用于识别用户按键和获得按键值。
函数原
型是:
int b ioskey(int cmd);
在<b ios.h>中定义,在使用它时,应用include命令将b ios.h文件包含进来。
其中参数cmd可取值0或1。
①当cmd=1时,检测键盘是否有击键,如果没有击键,函数将返回0,否则返回非零;
②当cmd=0时,返回从键盘输入的扫描码。
语句key=b ioskey(0);读取键盘输入的扫描码,并存储在变量k ey 中。
键盘扫描码
键盘上的每一个键都有两个唯一的数值进行标志。
为什么要用两个数值而不是一个数值呢?这是因为一个键可以被按下,也可以被释放。
当一个键按下时,它们产生一个唯一的数值,当一个键被释放时,它也会产生一个唯一的数值,我们把这些数值都保存在一张表里面,到时候通过查表就可以知道是哪一个键被敲击,并且可以知道是它是被按下还是被释放了。
这些数值在系统中被称为键盘扫描码2扫描码大全扫描码键0x011b ESC0x3b00 F10x3c00 F20x3d00 F30x3e00 F40x3f00 F50x4000 F60x4100 F70x4200 F80x4300 F90x4400 F10主键盘区:0x2960 ~0x0231 10x0332 20x0433 30x0534 40x0635 50x0736 60x0837 70x0938 80x0a39 90x0b30 00x0c2d -0x0d3d =0x2b5c \0x0e08 退格键0x0f09 Tab0x1071 q0x1177 w0x1265 e0x1372 r0x1474 t0x1579 y0x1769 i0x186f o0x1970 p0x1a5b [0x1b5d ]0x1e61 a0x1f73 s0x2064 d0x2166 f0x2267 g0x2368 h0x246a j0x256b k0x266c l0x273b ;0x2827 '0x1c0d 回车0x2c7a z0x2d78 x0x2e63 c0x2f76 v0x3062 b0x316e n0x326d m0x332c ,0x342e .0x352f /0x3920 空格键0xe05b 左Win0xe05c 右Win0xe05d Menu右边数字键盘:0x5200 Insert0x4700 Home0x4900 Page UP 0x5300 Delete0x4f00 End0x5100 PageDown 0x4800 上箭头0x4b00 左箭头0x5000 下箭头0x4d00 右箭头0x352f /0x4a2d - (注意,这是数字键盘的)0x4737 70x4838 80x4939 90x4b34 40x4c35 50x4d36 60x4e2b +0x4f31 10x5032 20x5133 30x5230 00x532e Del通过PC机键盘输入汉字时,其中经过多次的代码转换:用户---汉字输入码---键盘---键盘扫描码---BIOS键盘驱动程序----ASCII码----汉字输入软件----汉字内码。
键盘码表,键盘扫描码,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------------------------------------------------------------------。
键盘键码表
keycode 0 =keycode 1 =keycode 2 =keycode 3 =keycode 4 =keycode 5 =keycode 6 =keycode 7 =keycode 8 = BackSpace keycode 9 = Tab keycode 10 =keycode 11 =keycode 12 = Clear keycode 13 = Enter keycode 14 =keycode 15 =keycode 16 = Shift_L keycode 17 = Control_L keycode 18 = Alt_L keycode 19 = Pause keycode 20 = Caps_Lock keycode 21 =keycode 22 =keycode 23 =keycode 24 =keycode 25 =keycode 26 =keycode 27 = Esc Escape keycode 28 =keycode 29 =keycode 30 =keycode 31 =keycode 32 = Space keycode 33 = Page Up keycode 34 = Page Down keycode 35 = End keycode 36 = Home keycode 37 = Left Arrow keycode 38 = Up Arrow keycode 39 = Right Arrow keycode 40 = Down Arrow keycode 41 = Select keycode 42 = Print keycode 43 = Execute keycode 44 =keycode 45 = Insert keycode 46 = Delete keycode 47 = Help keycode 48 = 0 ) keycode 49 = 1 ! keycode 50 = 2 @ keycode 51 = 3 # keycode 52 = 4 $ keycode 53 = 5 % keycode 54 = 6 ^ keycode 55 = 7 & keycode 56 = 8 * keycode 57 = 9 ( keycode 58 =keycode 59 =keycode 60 = keycode 61 = keycode 62 = keycode 63 = keycode 64 = keycode 65 = a A keycode 66 = b B keycode 67 = c C keycode 68 = d D keycode 69 = e E keycode 70 = f F keycode 71 = g G keycode 72 = h H keycode 73 = i I keycode 74 = j J keycode 75 = k K keycode 76 = l L keycode 77 = m M keycode 78 = n N keycode 79 = o O keycode 80 = p P keycode 81 = q Q keycode 82 = r R keycode 83 = s S keycode 84 = t T keycode 85 = u U keycode 86 = v V keycode 87 = w W keycode 88 = x X keycode 89 = y Y keycode 90 = z Z keycode 91 = keycode 92 = keycode 93 = keycode 94 = keycode 95 = keycode 96 = KP_0 keycode 97 = KP_1 keycode 98 = KP_2 keycode 99 = KP_3 keycode 100 = KP_4 keycode 101 = KP_5 keycode 102 = KP_6 keycode 103 = KP_7keycode 104 = KP_8keycode 105 = KP_9keycode 106 = KP_* KP_Multiply keycode 107 = KP_+ KP_Add keycode 108 = KP_Enter KP_Separator keycode 109 = KP_- KP_Subtract keycode 110 = KP_. KP_Decimal keycode 111 = KP_/ KP_Divide keycode 112 = F1keycode 113 = F2keycode 114 = F3keycode 115 = F4keycode 116 = F5keycode 117 = F6keycode 118 = F7keycode 119 = F8keycode 120 = F9keycode 121 = F10keycode 122 = F11keycode 123 = F12keycode 124 = F13keycode 125 = F14keycode 126 = F15keycode 127 = F16keycode 128 = F17keycode 129 = F18keycode 130 = F19keycode 131 = F20keycode 132 = F21keycode 133 = F22keycode 134 = F23keycode 135 = F24keycode 136 = Num_Lockkeycode 137 = Scroll_Lockkeycode 138 =keycode 139 =keycode 140 =keycode 141 =keycode 142 =keycode 143 =keycode 144 =keycode 145 =keycode 146 =keycode 147 =keycode 149 = keycode 150 = keycode 151 = keycode 152 = keycode 153 = keycode 154 = keycode 155 = keycode 156 = keycode 157 = keycode 158 = keycode 159 = keycode 160 = keycode 161 = keycode 162 = keycode 163 = keycode 164 = keycode 165 = keycode 166 = keycode 167 = keycode 168 = keycode 169 = keycode 170 = keycode 171 = keycode 172 = keycode 173 = keycode 174 = keycode 175 = keycode 176 = keycode 177 = keycode 178 = keycode 179 = keycode 180 = keycode 181 = keycode 182 = keycode 183 = keycode 184 = keycode 185 = keycode 186 = keycode 187 = =+ keycode 188 = ,< keycode 189 = -_ keycode 190 = .> keycode 191 = /?keycode 193 =keycode 194 =keycode 195 =keycode 196 =keycode 197 =keycode 198 =keycode 199 =keycode 200 =keycode 201 =keycode 202 =keycode 203 =keycode 204 =keycode 205 =keycode 206 =keycode 207 =keycode 208 =keycode 209 =keycode 210 = plusminus hyphen macron keycode 211 =keycode 212 = copyright registeredkeycode 213 = guillemotleft guillemotright keycode 214 = masculine ordfemininekeycode 215 = ae AEkeycode 216 = cent yenkeycode 217 = questiondown exclamdown keycode 218 = onequarter onehalf threequarters keycode 219 = [{keycode 220 = \|keycode 221 = ]}keycode 222 = '"keycode 223 =keycode 224 =keycode 225 =keycode 226 =keycode 227 = multiply divisionkeycode 228 = acircumflex Acircumflex keycode 229 = ecircumflex Ecircumflex keycode 230 = icircumflex Icircumflexkeycode 231 = ocircumflex Ocircumflex keycode 232 = ucircumflex Ucircumflex keycode 233 = ntilde Ntildekeycode 234 = yacute Yacutekeycode 235 = oslash Oobliquekeycode 236 = aring Aringkeycode 237 = ccedilla Ccedillakeycode 238 = thorn THORNkeycode 239 = eth ETHkeycode 240 = diaeresis cedilla currencykeycode 241 = agrave Agrave atilde Atildekeycode 242 = egrave Egravekeycode 243 = igrave Igravekeycode 244 = ograve Ograve otilde Otildekeycode 245 = ugrave Ugravekeycode 246 = adiaeresis Adiaeresiskeycode 247 = ediaeresis Ediaeresiskeycode 248 = idiaeresis Idiaeresiskeycode 249 = odiaeresis Odiaeresiskeycode 250 = udiaeresis Udiaeresiskeycode 251 = ssharp question backslashkeycode 252 = asciicircum degreekeycode 253 = 3 sterlingkeycode 254 = Mode_switch使用示例:if ((window.event.ctrlKey)&&(window.event.keyCode==49))alert("您按下了CTRL+1键");从以上例子可以看出,shift、Control、Alt 在JS中也可用“window.event.shiftKey”、“window.event.ctrlKey”、“window.event.altKey” 代替。
键盘数字对应的ASCII码(keycode码)
键盘数字对应的ASCII码(keycode码)keycode 1 = ⿏标左键keycode 2 = ⿏标右键keycode 3 = Cancelkeycode 4 = ⿏标中键keycode 8 = BackSpacekeycode 9 = Tabkeycode 12 = Clear(未知)keycode 13 = Enterkeycode 16 = Shift_Lkeycode 17 = Control_Lkeycode 18 = Alt_Lkeycode 19 = Pausekeycode 20 = Caps_Lockkeycode 27 = Escapekeycode 32 = spacekeycode 33 = Prior(PageUp键)keycode 34 = Next(PageDown键)keycode 35 = Endkeycode 36 = Homekeycode 37 = Leftkeycode 38 = Upkeycode 39 = Rightkeycode 40 = Downkeycode 41 = Select(未知)keycode 42 = Print(PrintScreen键)keycode 43 = Execute(未知)keycode 45 = Insertkeycode 46 = Deletekeycode 47 = Help(未知)keycode 48 = 0 equal bracerightkeycode 49 = 1 exclam onesuperiorkeycode 50 = 2 quotedbl twosuperiorkeycode 51 = 3 section threesuperiorkeycode 52 = 4 dollarkeycode 53 = 5 percentkeycode 54 = 6 ampersandkeycode 55 = 7 slash braceleftkeycode 56 = 8 parenleft bracketleftkeycode 57 = 9 parenright bracketrightkeycode 65 = a Akeycode 66 = b Bkeycode 67 = c Ckeycode 68 = d Dkeycode 69 = e E EuroSignkeycode 70 = f Fkeycode 71 = g Gkeycode 72 = h Hkeycode 73 = i Ikeycode 74 = j Jkeycode 75 = k Kkeycode 76 = l Lkeycode 77 = m M mukeycode 78 = n Nkeycode 79 = o Okeycode 80 = p Pkeycode 81 = q Q atkeycode 82 = r Rkeycode 83 = s Skeycode 84 = t Tkeycode 85 = u Ukeycode 86 = v Vkeycode 87 = w Wkeycode 88 = x Xkeycode 89 = y Ykeycode 90 = z Zkeycode 96 = KP_0 KP_0(⼩键盘数字0)keycode 97 = KP_1 KP_1(⼩键盘数字1)keycode 98 = KP_2 KP_2(⼩键盘数字2)keycode 99 = KP_3 KP_3(⼩键盘数字3)keycode 100 = KP_4 KP_4(⼩键盘数字4)keycode 101 = KP_5 KP_5(⼩键盘数字5)keycode 102 = KP_6 KP_6(⼩键盘数字6)keycode 103 = KP_7 KP_7(⼩键盘数字7)keycode 104 = KP_8 KP_8(⼩键盘数字8)keycode 105 = KP_9 KP_9(⼩键盘数字9)keycode 106 = KP_Multiply KP_Multiply(⼩键盘乘)keycode 107 = KP_Add KP_Add(⼩键盘加)keycode 108 = KP_Separator KP_Separator(⼩键盘回车键)keycode 109 = KP_Subtract KP_Subtract(⼩键盘减)keycode 110 = KP_Decimal KP_Decimal(⼩键盘⼩数点)keycode 111 = KP_Divide KP_Divide(⼩键盘除)keycode 112 = F1keycode 113 = F2keycode 114 = F3keycode 115 = F4keycode 116 = F5keycode 117 = F6keycode 118 = F7keycode 119 = F8keycode 120 = F9keycode 121 = F10keycode 122 = F11keycode 123 = F12keycode 124 = F13keycode 125 = F14keycode 126 = F15keycode 127 = F16keycode 128 = F17keycode 129 = F18keycode 130 = F19keycode 131 = F20keycode 132 = F21keycode 133 = F22keycode 134 = F23keycode 135 = F24keycode 136 = Num_Lockkeycode 137 = Scroll_Lock(未知)keycode 187 = acute grave(未知)keycode 188 = comma semicolon(未知)(逗号分号)keycode 189 = minus underscore (减号下划线)keycode 190 = period colon (未知冒号)keycode 192 = numbersign apostrophe(未知单引号)keycode 210 = plusminus hyphen macron (未知 & ^)keycode 211 =keycode 212 = copyright registered(未知)keycode 213 = guillemotleft guillemotright(未知)keycode 214 = masculine ordfeminine(未知)keycode 215 = ae AE(未知)keycode 216 = cent yen(未知)keycode 217 = questiondown exclamdown(未知)keycode 218 = onequarter onehalf threequarters(未知)keycode 220 = less greater bar(⼩于号⼤于号未知)keycode 221 = plus asterisk asciitilde(加号星号未知)keycode 227 = multiply division(乘除)keycode 228 = acircumflex Acircumflex(未知)keycode 229 = ecircumflex Ecircumflex(未知)keycode 230 = icircumflex Icircumflex(未知)keycode 231 = ocircumflex Ocircumflex(未知)keycode 232 = ucircumflex Ucircumflex(未知)keycode 233 = ntilde Ntilde(未知)keycode 234 = yacute Yacute(未知)keycode 235 = oslash Ooblique(未知)keycode 236 = aring Aring(未知)keycode 237 = ccedilla Ccedilla(未知)keycode 238 = thorn THORN(未知)keycode 239 = eth ETH(未知)keycode 240 = diaeresis cedilla currency(未知)keycode 241 = agrave Agrave atilde Atilde(未知)keycode 242 = egrave Egrave(未知)keycode 243 = igrave Igrave(未知)keycode 244 = ograve Ograve otilde Otilde(未知)keycode 245 = ugrave Ugrave(未知)keycode 246 = adiaeresis Adiaeresis(未知)keycode 247 = ediaeresis Ediaeresis(未知)keycode 248 = idiaeresis Idiaeresis(未知)keycode 249 = odiaeresis Odiaeresis(未知)keycode 250 = udiaeresis Udiaeresis(未知)keycode 251 = ssharp question backslash(未知)keycode 252 = asciicircum degree(未知)keycode 253 = 3 sterling(未知)keycode 254 = Mode_switch(未知)如果要使⽤组合键,则可以利⽤event.ctrlKey,event.shiftKey,event .altKey值为true或false,判断是否按下了ctrl键、shift键以及alt键。
键盘码表:单键扫描码,ascii,组合键码
字母和空格按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码a 1E 61 1E 41 1E 01 1E 00b 30 62 30 42 30 02 30 00c 2E 63 2E 43 2E 03 2E 00d 20 64 20 44 20 04 20 00e 12 65 12 45 12 05 12 00f 21 66 21 46 21 06 21 00g 22 67 22 47 22 07 22 00h 23 68 23 48 23 08 23 00i 17 69 17 49 17 09 17 00 j 24 6A 24 4A 24 0A 24 00 k 25 6B 25 4B 25 0B 25 00 l 26 6C 26 4C 26 0C 26 00 m 32 6D 32 4D 32 0D 32 00 n 31 6E 31 4E 31 0E 31 00 o 18 6F 18 4F 18 0F 18 00 p 19 70 19 50 19 10 19 00 q 10 71 10 51 10 11 10 00 r 13 72 13 52 13 12 13 00 s 1F 73 1F 53 1F 13 1F 00 t 14 74 14 54 14 14 14 00 u 16 75 16 55 16 15 16 00 v 2F 76 2F 56 2F 16 2F 00 w 11 77 11 57 11 17 11 00 x 2D 78 2D 58 2D 18 2D 00 y 15 79 15 59 15 19 15 00 z 2C 7A 2C 5A 2C 1A 2C 00 SpaceBar 39 20 39 20 39 20 39 20功能键和数字键盘的编码表·内容正文按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码F1 3B 00 54 00 5E 00 68 00 F2 3C 00 55 00 5F 00 69 00 F3 3D 00 56 00 60 00 6A 00 F4 3E 00 57 00 61 00 6B 00 F5 3F 00 58 00 62 00 6C 00 F6 40 00 59 00 63 00 6D 00 F7 41 00 5A 00 64 00 6E 00 F8 42 00 5B 00 65 00 6F 00 F9 43 00 5C 00 66 00 70 00 F10 44 00 5D 00 67 00 71 00 F11 85 00 87 00 89 00 8B 00 F12 86 00 88 00 8A 00 8C 00 键盘码表:单键扫描码,ascii,组合键码数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Ins&0 52 00 52 30 92 00 00 End&1 4F 00 4F 31 75 00 00 01 ↓&2 50 00 50 32 91 00 00 02 PgDn&3 51 00 51 33 76 00 00 03 ←&4 4B 00 4B 34 73 00 00 04 5 4C 00 4C 35 8F 00 00 05 →&6 4D 00 4D 36 74 00 00 06 Home&7 47 00 47 37 77 00 00 07 ↑&8 48 00 48 38 8D 00 00 08 PgUp&9 49 00 49 39 84 00 00 09 + 4E 2B 4E 2B 90 00 4E 00 - 4A 2D 4A 2D 8E 00 4A 00 Del&'.' 53 00 53 2E 93 00 00 * 37 2A 37 2A 96 00 37 00第一排数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码`@~ 29 60 29 7E 00 29 00 1@! 02 31 02 21 00 78 00 2@@ 03 32 03 40 03 00 79 00 3@# 04 33 04 23 00 7A 00 4@$ 05 34 05 24 00 7B 00 5@% 06 35 06 25 00 7C 00 6@^ 07 36 07 5E 07 1E 7D 00 7@& 08 37 08 26 00 7E 00 8@* 09 38 09 2A 00 7F 00 9@( 0A 39 0A 38 00 80 00 0@) 0B 30 0B 29 00 81 00 -@_0C 2D 0C 5F 0C 1F 82 00 =@+0D 3D 0D 2B 00 83 00操作、标号和附加按键等的编码表·内容正文按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Esc 01 1B 01 1B 01 1B 01 00 Backspace 0E 08 0E 08 0E 7F 0E 00 Tab 0F 09 0F 00 94 00 A5 00 Enter 1C 0D 1C 0D 1C 0A 1C 00标号按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码[@{ 1A 5B 1A 7B 1A 1B 1A 00]@} 1B 5D 1B 7D 1B 1D 1B 00 ;@: 27 3B 27 3A 00 27 00 @" 28 27 28 22 00 28 00 \@| 2b 5C 2b 7C 2B 1C 2b 00 , @ < 33 2C 33 3C 00 33 00 . @> 34 2E 34 3E 00 34 00 / @ ? 35 2F 35 3F 00 35 00、附加按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Flash(/) E0 2F E0 2F 95 00 A4 00 Enter E0 0D E0 0D E0 0A A6 00 Home 47 E0 47 E0 77 E0 97 00 End 4F E0 4F E0 75 E0 9F 00 PageUp 49 E0 49 E0 84 E0 99 00 PageDown 51 E0 51 E0 76 E0 A1 00 DnArrow 50 E0 50 E0 91 E0 A0 00 LeftArrow 4B E0 4B E0 73 E0 9B 00 RightArrow 4D E0 4D E0 74 E0 9D 00 UpArrow 48 E0 48 E0 8D E0 98 00 Ins 52 E0 52 E0 92 E0 A2 00 Del 53 E0 53 E0 93 E0 A3 00其它按键的扫描码当这些键被按下时,BIOS并没有把它们的扫描码输入键盘缓冲区。
PC键盘扫描码
O:就是利用bioskey()得到的值。
参数为0时,bioskey()的返回值如果低八位非0,表示按下了普通键;如果低八位为0,表示按下了功能键。
参数为1时,检测有没有键被按下,如果返回值为0,表示没有键按下,相反有键按下。
参数为2时,表示获取变换键的状态,哪些是变换键呢?变换键包括双态键和控制键,双态键就是num lock、scroll lock、insert和caps lock,控制键就是左右shift、ctrl和alt,返回值的低八位反映了这些变换键的状态:0x01 右边shift0x10 scroll lock打开0x02 左边shift0x20 num lock打开0x04 ctrl键0x40 caps lock打开0x08 alt键0x80 insert打开其实bioskey直接调用bios的int 16h键盘I/O中断,直接就是int 16h 的完整翻版。
键盘扫描码大全对程序进行键盘控制时,往往要用到一些键的扫描码,以前每次用时都得先扫下试试,实在麻烦,今天又搞了个小程序,用到了扫描码,索性整了个测试程序,把所有键的扫描码全存入一个文件啦,以便以后编程时使用.在此跟大家分享一下,虽然得来非常容易,但至少可以免得大家都像我以前那样用时再查扫描码键0x011b ----- ESC0x3b00 ----- F1 0x3c00 ----- F20x3d00 ----- F30x3e00 ----- F40x3f00 ----- F50x4000 ----- F60x4100 ----- F70x4200 ----- F80x4300 ----- F90x4400 ----- F10主键盘区:0x2960 ----- ~0x0231 ----- 10x0332 ----- 20x0433 ----- 30x0534 ----- 40x0635 ----- 50x0736 ----- 60x0837 ----- 70x0938 ----- 80x0a39 ----- 90x0b30 ----- 00x0c2d ----- -0x0d3d ----- =0x2b5c ----- \0x0e08 ----- 退格键0x0f09 ----- Tab0x1071 ----- q0x1177 w0x1265 e0x1372 r0x1474 t0x1579 y0x1675 u0x1769 i0x186f o0x1970 p0x1a5b [0x1b5d ]0x1e61 a0x1f73 s0x2064 d0x2166 f0x2267 g0x2368 h0x246a j0x256b k0x266c l0x273b0x2827 '0x1c0d 回车0x2c7a z0x2d78 x0x2e63 c0x2f76 v0x3062 b0x316e n0x326d m0x332c ,0x342e .0x352f /0x3920 空格键右边数字键盘:0x5200 Insert0x4700 Home0x4900 Page UP0x5300 Delete0x4f00 End0x5100 PageDown0x4800 上箭头0x4b00 左箭头0x5000 下箭头0x4d00 右箭头0x352f /0x372a *0x4a2d - (注意,这是数字键盘的) 0x4737 70x4838 80x4939 90x4b34 40x4c35 50x4d36 60x4e2b +0x4f31 10x5032 20x5133 30x5230 00x532e DelCtrl+字母:在字母扫描码的基础上减去0x0060alt+字母: 在字母的基础上,把最后两位变成00shift+字母:在字母的基础上减去0x0020比如: a----0x1e61 Ctrl+a----0x1e01 Alt+a-----0x1e00b----0x3062 Ctrl+b----0x3002 Alt+b-----0x3000另加: Ctrl+Enter: 0x1c0a可以直接用一个程序查看的,很简单的#include “stdio.h”#include “bios.h”void main(void){int key, modifiers;while ((key=bioskey(0)) != 0 && key!=0x11b){printf("0x%x \n",key);}}*********************************************************** ********************上面列出的编码中,前面两位是“扫描码”,后面两位是ASCII码,合起来是所谓的“键盘码”比如,小键盘的数字键扫描码和大键盘的数字键是不同的,而后两位是一样的,因为那个是它们共用的ASCII码,下面就是扫描码的列表Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B|40 64 F601 1 ESC |11 17 W |21 33 F |31 49 N |41 65 F702 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 68 F1005 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 72 Up09 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 75 Left0C 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 79 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|Num Lok|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 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 speci al codesare 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-P 1E 30 Alt-A 1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L 2C 44 Alt-Z 2D 45 Alt-X 2E 46 Alt-C 2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M 3B 59 F13C 60 F23D 61 F3-------------------------------------- 3E 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-F10 5E 94 Ctrl-F1 5F 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-F2 6A 106 Alt-F3 6B 107 Alt-F46D 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-083 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down 8A 138 Ctrl-Ins8B 139 Ctrl-Del8C 140 Alt-Home 8D 141 Alt-Up8E 142 Alt-PgUp 8F 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-InsExtended 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-PgUp 4A 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-Center 4D 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 | |------------------+-------------------+-------------------+--------------------。
键盘扫描码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条。
key code 组合键 原理
key code 组合键原理
Key Code 组合键原理
一、概述
Key Code,也称为键码或键值,是一个在计算机编程中广泛使用的概念。
它代表了键盘上每个键的唯一标识符,用于识别和区分不同的按键输入。
组合键则是通过同时按下多个键来实现特定的功能或操作。
了解Key Code组合键的原理,有助于更好地理解和使用键盘输入,提高工作效率。
二、Key Code的原理
Key Code的原理基于键盘矩阵。
键盘矩阵由行和列组成,每个键都位于行和列的交叉点上。
当按下某个键时,键盘控制器会检测到该键所在的行和列被按下,从而确定被按下的键的Key Code。
不同的键盘布局和设计可能会有不同的Key Code分配。
因此,在实际编程中,为了实现跨平台的键盘输入兼容性,通常需要使用更为抽象的键码库,如SDL、GLFW等。
这些库提供了一套统一的接口,用于处理不同的键盘布局和键码映射。
三、组合键的原理
组合键的实现原理相对简单。
当用户按下某个组合键时,键盘会将所有按下的键的Key Code发送给计算机。
应用程序通过检测这些Key Code的组合来判断是否按下了组合键,并执行相应的操作。
在大多数操作系统中,组合键的具体实现方式可能会有所不同。
例如,在Windows中,可以使用WinAPI函数来检测组合键的状态;在Linux中,可以使用Xlib等库来处理组合键的输入。
总之,了解Key Code和组合键的原理有助于更好地利用键盘输入,提高工作效率。
在实际应用中,需要结合具体的平台和开发环境,选择合适的键盘输入处理方式。
c语言键盘扫描码大全
c语言键盘扫描码大全对程序进行键盘控制时,往往要用到一些键的扫描码,以前每次用时都得先扫下试试,实在麻烦,今天又搞了个小程序,用到了扫描码,索性整了个测试程序,把所有键的扫描码全存入一个文件啦,以便以后编程时使用.在此跟大家分享一下,c语言键盘扫描码 扫描码键 0x011bESC 0x3b00F1 0x3c00F2 0x3d00F3 0x3e00F4 0x3f00F5 0x4000F6 0x4100F7 0x4200F8 0x4300F9 0x4400F10 主键盘区: 0x2960~ 0x02311 0x03322 0x04333 0x05344 0x06355 0x07366 0x08377 0x09388 0x0a399 0x0b300 0x0c2d- 0x0d3d= 0x2b5c\ 0x0e08退格键 0x0f09Tab 0x1071q 0x1177w 0x1265e 0x1372r 0x1474t 0x1579y 0x1675u 0x1769i 0x186fo 0x1970p 0x1a5b[ 0x1b5d] 0x1e61a 0x1f73s 0x2064d 0x2166f 0x2267g 0x2368h 0x246aj 0x256bk 0x266cl 0x273b; 0x2827’ 0x1c0d回车 0x2c7az 0x2d78x 0x2e63c 0x2f76v 0x3062b 0x316en 0x326dm 0x332c, 0x342e. 0x352f/ 0x3920空格键 右边数字键盘: 0x5200Insert 0x4700Home 0x4900Page UP 0x5300Delete 0x4f00End 0x5100PageDown 0x4800上箭头 0x4b00左箭头 0x5000下箭头 0x4d00右箭头 0x352f/ 0x372a* 0x4a2d- (注意,这是数字键盘的) 0x47377 0x48388 0x49399 0x4b344 0x4c355 0x4d366 0x4e2b+ 0x4f311 0x50322 0x51333 0x52300 0x532eDel 以上就是由为您提供的c语言键盘扫描码,希望给您带来帮助! 。
键盘映射之ScanCode码
Scan Code 28 00 0C 00 33 00 34 00 35 00 27 00 1A 00 2B 00 1B 00 29 00 0D 00 0B 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 0A 00 1E 00 30 00 2E 00 20 00 12 00 21 00 22 00 23 00 17 00 24 00 25 00 26 00 32 00 31 00 18 00 19 00 10 00 13 00 1F 00 14 00
第 4 页 共 6 页
秦爱网志
CONVERT NONCONVERT Manufacturer Dell Dell Dell Dell Dell Logitech Logitech Logitech Web Keys Back Favorites Forward HOME Refresh Search Stop Disable Microsoft Keyboard My Pictures My Music Mute Play/Pause Stop + (Volume up) - (Volume down) |<< (Previous) >>| (Next) Media Mail Web/Home Messenger Calculator Natural Multimedia
Scan Code 5D E0 0E 00 3A 00 53 E0 4F E0 1C 00 01 00 47 E0 52 E0 38 00 1D 00 2A 00 5B E0 45 00 51 E0 49 E0 5E E0 37 E0 38 E0 1D E0 36 00 5C E0 46 00 5F E0 39 00 0F 00 63 E0 Scan Code 52 00 4F 00 50 00 51 00 4B 00 4C 00 4D 00 47 00 48 00
键盘码表,键盘扫描码,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------------------------------------------------------------------。
键盘码表 单键扫描码 ascii 组合键码
字母和空格按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码a 1E 61 1E 41 1E 01 1E 00b 30 62 30 42 30 02 30 00c 2E 63 2E 43 2E 03 2E 00d 20 64 20 44 20 04 20 00e 12 65 12 45 12 05 12 00f 21 66 21 46 21 06 21 00g 22 67 22 47 22 07 22 00h 23 68 23 48 23 08 23 00i 17 69 17 49 17 09 17 00 j 24 6A 24 4A 24 0A 24 00 k 25 6B 25 4B 25 0B 25 00 l 26 6C 26 4C 26 0C 26 00 m 32 6D 32 4D 32 0D 32 00 n 31 6E 31 4E 31 0E 31 00 o 18 6F 18 4F 18 0F 18 00 p 19 70 19 50 19 10 19 00 q 10 71 10 51 10 11 10 00 r 13 72 13 52 13 12 13 00 s 1F 73 1F 53 1F 13 1F 00 t 14 74 14 54 14 14 14 00 u 16 75 16 55 16 15 16 00 v 2F 76 2F 56 2F 16 2F 00 w 11 77 11 57 11 17 11 00 x 2D 78 2D 58 2D 18 2D 00 y 15 79 15 59 15 19 15 00 z 2C 7A 2C 5A 2C 1A 2C 00 SpaceBar 39 20 39 20 39 20 39 20功能键和数字键盘的编码表·内容正文按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码F1 3B 00 54 00 5E 00 68 00 F2 3C 00 55 00 5F 00 69 00 F3 3D 00 56 00 60 00 6A 00 F4 3E 00 57 00 61 00 6B 00 F5 3F 00 58 00 62 00 6C 00 F6 40 00 59 00 63 00 6D 00 F7 41 00 5A 00 64 00 6E 00 F8 42 00 5B 00 65 00 6F 00 F9 43 00 5C 00 66 00 70 00 F10 44 00 5D 00 67 00 71 00 F11 85 00 87 00 89 00 8B 00 F12 86 00 88 00 8A 00 8C 00 键盘码表:单键扫描码,ascii,组合键码数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Ins&0 52 00 52 30 92 00 00 End&1 4F 00 4F 31 75 00 00 01 ↓&2 50 00 50 32 91 00 00 02 PgDn&3 51 00 51 33 76 00 00 03 ←&4 4B 00 4B 34 73 00 00 04 5 4C 00 4C 35 8F 00 00 05 →&6 4D 00 4D 36 74 00 00 06 Home&7 47 00 47 37 77 00 00 07 ↑&8 48 00 48 38 8D 00 00 08 PgUp&9 49 00 49 39 84 00 00 09 + 4E 2B 4E 2B 90 00 4E 00 - 4A 2D 4A 2D 8E 00 4A 00 Del&'.' 53 00 53 2E 93 00 00 * 37 2A 37 2A 96 00 37 00第一排数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码`@~ 29 60 29 7E 00 29 00 1@! 02 31 02 21 00 78 00 2@@ 03 32 03 40 03 00 79 00 3@# 04 33 04 23 00 7A 00 4@$ 05 34 05 24 00 7B 00 5@% 06 35 06 25 00 7C 00 6@^ 07 36 07 5E 07 1E 7D 00 7@& 08 37 08 26 00 7E 00 8@* 09 38 09 2A 00 7F 00 9@( 0A 39 0A 38 00 80 00 0@) 0B 30 0B 29 00 81 00 -@_0C 2D 0C 5F 0C 1F 82 00 =@+0D 3D 0D 2B 00 83 00操作、标号和附加按键等的编码表·内容正文按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Esc 01 1B 01 1B 01 1B 01 00 Backspace 0E 08 0E 08 0E 7F 0E 00 Tab 0F 09 0F 00 94 00 A5 00 Enter 1C 0D 1C 0D 1C 0A 1C 00标号按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码[@{ 1A 5B 1A 7B 1A 1B 1A 00]@} 1B 5D 1B 7D 1B 1D 1B 00 ;@: 27 3B 27 3A 00 27 00 @" 28 27 28 22 00 28 00 \@| 2b 5C 2b 7C 2B 1C 2b 00 , @ < 33 2C 33 3C 00 33 00 . @> 34 2E 34 3E 00 34 00 / @ ? 35 2F 35 3F 00 35 00、附加按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Flash(/) E0 2F E0 2F 95 00 A4 00 Enter E0 0D E0 0D E0 0A A6 00 Home 47 E0 47 E0 77 E0 97 00 End 4F E0 4F E0 75 E0 9F 00 PageUp 49 E0 49 E0 84 E0 99 00 PageDown 51 E0 51 E0 76 E0 A1 00 DnArrow 50 E0 50 E0 91 E0 A0 00 LeftArrow 4B E0 4B E0 73 E0 9B 00 RightArrow 4D E0 4D E0 74 E0 9D 00 UpArrow 48 E0 48 E0 8D E0 98 00 Ins 52 E0 52 E0 92 E0 A2 00 Del 53 E0 53 E0 93 E0 A3 00其它按键的扫描码当这些键被按下时,BIOS并没有把它们的扫描码输入键盘缓冲区。
小键盘的原理
系统扫描码 在我们通常所使用的pc机上,系统(BIOS, linux内核)处理的并不是键盘扫描码,而是 系统扫描码。而键盘扫描码到系统扫描码的 转换通常都是由硬件(如PC键盘接口模块 8042)完成。系统扫描码与键盘扫描码除了 每个键的代码不同外,最大的差别是把键盘 放下时产生的两个键盘扫描码(共两字节) 转换为1个字节的系统扫描码表示。如‘A’被 键释放时,发送键盘扫描码为:F0H,1CH, 相应的系统扫描码为9E。
实现按“1”,在屏幕上显示“HELLO”
其命令如下:
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/socket.h> #include <syslog.h> #include <signal.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <syslog.h> #include <signal.h> #include "led_ioctl.h" #define NOKEY 0
键码 内核中为了方便键盘按键的处理,把系统扫 描码对应成键码(keycode)。键码在1- 128之间(一般的键盘为104键),这样键码 就可用7位来表示键盘上某个键(内核中用键 码字节的高位表示此键是按下还是松开)。
2. 键盘按键值的获取 PC机的PS2键盘按键太多,若是采用轮询方式将浪费CPU时 间。因此采用的是中断方式。通用的键值获取流程如下:
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
键盘扫描码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条。