1、语言中键盘扫描码如何使用?2008-11-14 16:21就是利用 bioskey()得到的值。参数为 0时,bioskey()的返回值如果低八位非 0,表示按下了普通键;如果低八位为 0,表示按下了功能键。参数为 1时,检测有没有键被按下,如果返回值为 0,表示没有键按下,相反有键按下。参数为 2时,表示获取变换键的状态,哪些是变换键呢?变换键包括双态键和控制键,双态键就是 num lock、scroll lock、insert 和 caps lock,控制键就是左右 shift、ctrl 和 alt,返回值的低八位反映了这些变换键的状态:0x01 右边 shift0x02 左边 shift
2、0x04 ctrl键0x08 alt键0x10 scroll lock打开0x20 num lock打开0x40 caps lock打开0x80 insert打开其实 bioskey直接调用 bios的 int 16h键盘 I/O中断,直接就是 int 16h的完整翻版。键盘扫描码大全对程序进行键盘控制时,往往要用到一些键的扫描码,以前每次用时都得先扫下试试,实在麻烦,今天又搞了个小程序,用到了扫描码,索性整了个测试程序,把所有键的扫描码全存入一个文件啦,以便以后编程时使用.在此跟大家分享一下,虽然得来非常容易,但至少可以免得大家都像我以前那样用时再查扫描码 键0x011b ESC0x3b00
3、 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 y0x1675 u0x1769 i0x186f o0x1970 p
4、0x1a5b 0x1b5d 0x1e61 a0x1f73 s0x2064 d0x2166 f0x2267 g0x2368 h0x246a j0x256b k0x266c l0x273b ;0x2827 0x1c0d 回车0x2c7a z0x2d78 x0x2e63 c0x2f76 v0x3062 b0x316e n0x326d m0x332c ,0x342e .0x352f /0x3920 空格键右边数字键盘:0x5200 Insert0x4700 Home0x4900 Page UP0x5300 Delete0x4f00 End0x5100 PageDown0x4800 上箭头0x4b00
5、左箭头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
6、Alt+b-0x3000另加: Ctrl+Enter: 0x1c0a可以直接用一个程序查看的 很简单的#include #include void main(void)int key, modifiers;while (key=bioskey(0) != 0 *上面列出的编码中,前面两位是“扫描码”,后面两位是 ASCII码,合起来是所谓的“键盘码”比如,小键盘的数字键扫描码和大键盘的数字键是不同的,而后两位是一样的,因为那个是它们共用的 ASCII码下面就是扫描码的列表Keyboard Scan Codes (Numerical Order)-+-+-+-+-HEX DEC keys |HE
7、X 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
8、 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 Left0
9、C 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 (R
10、ead 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
11、 | 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
12、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 |7
13、7 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 38
14、0 |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 | | | | |
15、 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
16、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
17、 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-F105E 94 Ctrl-F15F 95 Ctrl-F260 96 Ctr
18、l-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 1
19、18 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-Del
20、8C 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 | HE
21、X 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
22、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
23、 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
Copyright © 2018-2021 Wenke99.com All rights reserved
工信部备案号:浙ICP备20026746号-2
公安局备案号:浙公网安备33038302330469号
本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。