# 改变键映射

本篇文章主要介绍的是使用注册表调换按键,比如将大小写键和ESC键对换。

# 修改步骤

  1. 找到注册表HKEY_LOCAL_MACHINE\SYSTEM\Current ControlSet\Control\Keyboard Layout。
  2. 在Keyboard Layout右键->新建二进制项->新建Scancode Map。
  3. 输入要修改的值,重启电脑修改完毕。

# 修改值

下面的ScancodeMap值将大小写和ESC键对换:

00000000 00000000
03000000 3A000100
01003A00 00000000
1
2
3

# 解释格式

下面来解释下上面的二进制格式:

  1. 第一行为版本号和头部字节,一般为空。
  2. 第二行前4个字节,是映射键的总数,按照二进制的读写规则,低位在左,高位在右。02 00 00 00 这个数实际就是:00 00 00 02 。注意一个映射键组8位为一组,每个映射键组前4位为映射后的按键扫描码,后4位为映射前的按键扫描码。最后会以一组8位0结束,因此上面的映射键总数总是比后面的映射键组数多1。注意,输入映射键组时需要把扫描码的高低字节交换一下。

# 键位表

下面是常见的键位表:

Backspace 00 0E 
Caps Lock 00 3A 
Delete E0 53 
End E0 4F 
Enter 00 1C 
Escape 00 01 
HOME E0 47 
Insert E0 52 
Left Alt 00 38 
Left Ctrl 00 1D 
Left Shift 00 2A 
Left Windows E0 5B 
Num Lock 00 45 
Page Down E0 51 
Page Up E0 49 
Power E0 5E 
PrtSc E0 37 
Right Alt E0 38 
Right Ctrl E0 1D 
Right Shift 00 36 
Right Windows E0 5C 
Scroll Lock 00 46 
Sleep E0 5F 
Space 00 39 
Tab 00 0F 
Wake E0 63 
0 00 52 
1 00 4F 
2 00 50 
3 00 51 
4 00 4B 
5 00 4C 
6 00 4D 
7 00 47 
8 00 48 
9 00 49 
- 00 4A 
/* 00 37 
. 00 53 
/ 00 35 
/+ 00 4E 
Enter E0 1C 
F1 00 3B 
F2 00 3C 
F3 00 3D 
F4 00 3E 
F5 00 3F 
F6 00 40 
F7 00 41 
F8 00 42 
F9 00 43 
F10 00 44 
F11 00 57 
F12 00 58 
F13 00 64 
F14 00 65 
F15 00 66 
Down E0 50 
Left E0 4B 
Right E0 4D 
Up E0 48 
Calculator E0 21 
E-Mail E0 6C 
Media Select E0 6D 
Messenger E0 11 
My Computer E0 6B 
’ ” 00 28 
- _ 00 0C 
, < 00 33 
. > 00 34 
/ ? 00 35 
; : 00 27 
[ { 00 1A 
\ | 00 2B 
] } 00 1B 
` ~ 00 29 
= + 00 0D 
0 ) 00 0B 
1 ! 00 02 
2 @ 00 03 
3 # 00 04 
4 $ 00 05 
5 % 00 06 
6 ^ 00 07 
7 & 00 08 
8 * 00 09 
9 ( 00 0A 
A 00 1E 
B 00 30 
C 00 2E 
D 00 20 
E 00 12 
F 00 21 
G 00 22 
H 00 23 
I 00 17 
J 00 24 
K 00 25 
L 00 26 
M 00 32 
N 00 31 
O 00 18 
P 00 19 
Q 00 10 
R 00 13 
S 00 1F 
T 00 14 
U 00 16 
V 00 2F 
W 00 11 
X 00 2D 
Y 00 15 
Z 00 2C 
Close E0 40 
Fwd E0 42 
Help E0 3B 
New E0 3E 
Office Home E0 3C 
Open E0 3F 
Print E0 58 
Redo E0 07 
Reply E0 41 
Save E0 57 
Send E0 43 
Spell E0 23 
Task Pane E0 3D 
Undo E0 08 
Mute E0 20 
Next Track E0 19 
Play/Pause E0 22 
Prev Track E0 10 
Stop E0 24 
Volume Down E0 2E 
Volume Up E0 30 
? - 00 7D 
E0 45 
Next to Enter E0 2B 
Next to L-Shift E0 56 
Next to R-Shift E0 73 
DBE_KATAKANA E0 70 
DBE_SBCSCHAR E0 77 
CONVERT E0 79 
NONCONVERT E0 7B 
Internet E0 01 
iTouch E0 13 
Shopping E0 04 
Webcam E0 12 
Back E0 6A 
Favorites E0 66 
Forward E0 69 
HOME E0 32 
Refresh E0 67 
Search E0 65 
Stop E0 68 
My Pictures E0 64 
My Music E0 3C 
Mute E0 20 
Play/Pause E0 22 
Stop E0 24 
+ (Volume up) E0 30 
- (Volume down) E0 2E 
Media E0 6D 
Mail E0 6C 
Web/Home E0 32 
Messenger E0 05 
Calculator E0 21 
Log Off E0 16 
Sleep E0 5F 
Help(on F1 key) E0 3B 
Undo(on F2 key) E0 08 
Redo(on F3 key) E0 07 
Fwd (on F8 key) E0 42 
Send(on F9 key) E0 43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
173