@torresdyl
2017-06-06T17:05:53.000000Z
字数 11187
阅读 18617
未分类
Microsoft Keyboard Layout Creator is the best application in Windows platform to manipulate keyboard layout. It permits you to change your keyboard layout in a standard way which is fully compatible with Windows system (including Windows 10) at the level of VK code (i.e. Virtual Key code.). The most important is, even the application itself does not permit remapping modifer keys (Ctrl, Alt, etc.), with a little hack, we can change this behaviour and remap them too, and make UAC dialog aware of them even at system start up! That gives us complete control over your keyboard layout!
Download MSKLC 1.4 in the link at the beginning. The developer of this application is Michael S. Kaplan. Cannot find much about this guy at Microsoft but I owe him a big thanks. It saves lots of days...
The required environment does not include Windows 10, but I find it working under Windows 10.
About how to use this software, you need a complete manual. Just explore and visit page to get some ideas:
http://www.angelfire.com/planet/linguisticsisfun/Creating_a_Keyboard_Using_MSKLC.pdf
You can learn by doing but at first, I must tell your some basic concepts in keyboard mapping.
Basically, MSKLC make it possible to:
map the four levels of a key, so that you can type up to 4 letters/symbols with combinations of one key and all the modifiers. (About levels on a key cap, make sure to read this Wikipedia article: https://en.wikipedia.org/wiki/ISO/IEC_9995, in the "Level and Group selection" section.)
Define "dead keys". Dead keys are keys used in a combination typing: by solely pressing it you don't get any output, like it is dead; then you press another key to get desired output. For example, in Spanish default keyboard layout, by default the key ´ is a dead key: you press it once and nothing happens; and you press it again, or press Space, two ´ are shown. Or, if you press a, you get á.

For example, in my current keyboard layout, O is in the original position of P. If I don't change the VK code, when I press Ctrl+O, OS thinks I pressed Ctrl+P(because the combination it receives is Ctrl+VK_P), and prompts me the system print dialog. The same applies to other programs, among those I use daily, Microsoft Pinyin IME (input method). It used to let me go to next page/previous page with . and ,. Now, with my new keyboard layout, without VK code modification, when I press . and ,, the application does not receive VK_COMMA and VK_FULLSTOP events, so it stops to behave as expected.
As Microsoft states, all applications should only detect VK codes instead of the hardware-dependant "scan code" directly sent by key strokes. (By the way, I found that Google Pinyin does poorly at this aspect: it detects "key char" when I choose characters, and detects VK code when I navigate pages. Very bad UX. )
I provide some links to help you understand it better:
Receiving Keyboard Input (Windows CE 5.0)
Keyboard Input
Full VK code table 1
Full VK code table 2

Also, it makes it possible to remap modifiers, like Shift, Ctrl, Alt, Enter, Backspace and CapsLock. Originally I use AutoHotKey to swap Capslock with Left shift, and to swap Enter with Left shift. But one shortcoming of this approach is that these swapping is not visible to the OS under certain sensitive circumstances, like in Regestry editor, UAC confirm dialog, and login screen. And, I cannot make
AHK script functioning upon system startup, and it must be initialized manually. But, if we use MSKLC to remap them (with a hack which I will mention below), in all of these places OS recognise our remapping, and it does upon startup! An OS level hack, I must say.
The images are more persuasive.
Unshifted (no Shift, Alt, Ctrl pressed) state:

Shifted state: (pressing Shift)

AltGr state: (pressing AltGr, usually Right Alt, a helper key to get extra charaters)

AltGr state: (pressing AltGr and Shift, for capitalized letters)

Checking the images closely enough, you will find them familiar but different from the standard QWERTY keyboard layout. Yes, it is what I want to achieve: instead of changing the alphabetical keys' positions, doing a functional optimization for all the symbol keys to make programming easier. So I name it
QWERT^ Programmer layout with symbol keys optimized
It has some important features:
All paired symbols, like {}, [], (), <> and /\, are located symmetrically at the top number line, and meant to be pressed with the same finger of each hand. We all like symmetry because it is faster to remember: when you can press { with your little finger of your left hand, you expect to press the right half with your right hand, and most likely, also with little finger. So here you have it.
Also, the order of symbols are not arbitrary: in Chinese, we literally call {} "big parethesis", [] as "middle-sized parethesis", () is "parenthesis", and <> is "little parenthesis", so there is an order from the biggest to the smallest. In Java, the order still stands: {} are for methods and blocks, [] are for arrays, () for methods signatures and <> are for parameters. The scope of these symbols are ranked from the biggest to the smallest. So the biggest should be outside, and the smallest be inside.
As for / and \, imagine your both hand: try make your both hands' fingers meet, and they form a triangle, so / is for left hand and \ is for right hand. That's why / is on the left and \ is on the riht. Self-explantory, I would say. And, they are very common so I would like to type them with my strogest index finger.
Now, note that they are designed to be able to type without Shift, because for us programmer, these symbols are essential, and more frecuently typed than numbers. I use a full-sized 104 key keyboard, so if I don't want to press Shift to press number keys,I have numpad for numbers. Alternatively, in MSKLC I enable "CapsLock = Shift" for these number keys, so that I can press CapsLock and happily type numbers without numpad.
Another thing is that the numbers are also symmetrically located, and 6 to 0 are moved two columns to the right, so I can type numbers and paired symbols comfortably without looking at the keyboard, e.g. touch typing. Inspired by a post from here, I began to think about a easily missed point: in a most ergonomically natural position,
our hands stretch to both sides, not to the left, so with numbers 0~9 sticking together and each hand handling 5 numbers, our right hand must extends itself to the left to cover its half, and it is wasted labor! But now, with 5 numbers on each side, I can spead my fingers to reach the keys symmetrically and naturally without moving my right hand, and it's faster to get to the right position.
KBD WTVKMS "QWERT^ (VK code, Modifiers and Symmetrical numbers) - CN"COPYRIGHT "(c) 2017 WindThunder Studio"COMPANY "WindThunder Studio"LOCALENAME "zh-CN"LOCALEID "00000804"VERSION 1.0SHIFTSTATE0 //Column 41 //Column 5 : Shft2 //Column 6 : Ctrl6 //Column 7 : Ctrl Alt7 //Column 8 : Shft Ctrl AltLAYOUT ;an extra '@' at the end is a dead key//SC VK_ Cap 0 1 2 6 7//-- ---- ---- ---- ---- ---- ---- ----02 1 1 007b 1 -1 -1 -1 // LEFT CURLY BRACKET, DIGIT ONE, <none>, <none>, <none>03 2 1 005b 2 -1 00b7 -1 // LEFT SQUARE BRACKET, DIGIT TWO, <none>, MIDDLE DOT, <none>04 3 1 0028 3 -1 20ac -1 // LEFT PARENTHESIS, DIGIT THREE, <none>, EURO SIGN, <none>05 4 1 003c 4 -1 -1 -1 // LESS-THAN SIGN, DIGIT FOUR, <none>, <none>, <none>06 5 1 002f 5 -1 -1 -1 // SOLIDUS, DIGIT FIVE, <none>, <none>, <none>07 OEM_MINUS 0 002d 005f -1 -1 -1 // HYPHEN-MINUS, LOW LINE, <none>, <none>, <none>08 OEM_PLUS 0 003d 002b -1 00ac -1 // EQUALS SIGN, PLUS SIGN, <none>, NOT SIGN, <none>09 6 1 005c 6 -1 -1 -1 // REVERSE SOLIDUS, DIGIT SIX, <none>, <none>, <none>0a 7 1 003e 7 -1 -1 -1 // GREATER-THAN SIGN, DIGIT SEVEN, <none>, <none>, <none>0b 8 1 0029 8 -1 -1 -1 // RIGHT PARENTHESIS, DIGIT EIGHT, <none>, <none>, <none>0c 9 1 005d 9 -1 00a1 -1 // RIGHT SQUARE BRACKET, DIGIT NINE, <none>, INVERTED EXCLAMATION MARK, <none>0d 0 1 007d 0 -1 00bf -1 // RIGHT CURLY BRACKET, DIGIT ZERO, <none>, INVERTED QUESTION MARK, <none>10 Q 1 q Q -1 -1 -1 // LATIN SMALL LETTER Q, LATIN CAPITAL LETTER Q, <none>, <none>, <none>11 W 1 w W -1 -1 -1 // LATIN SMALL LETTER W, LATIN CAPITAL LETTER W, <none>, <none>, <none>12 E 1 e E -1 -1 -1 // LATIN SMALL LETTER E, LATIN CAPITAL LETTER E, <none>, <none>, <none>13 R 1 r R -1 -1 -1 // LATIN SMALL LETTER R, LATIN CAPITAL LETTER R, <none>, <none>, <none>14 T 1 t T -1 -1 -1 // LATIN SMALL LETTER T, LATIN CAPITAL LETTER T, <none>, <none>, <none>15 OEM_6 0 0060 005e -1 00b4@ -1 // GRAVE ACCENT, CIRCUMFLEX ACCENT, <none>, ACUTE ACCENT, <none>16 Y 1 y Y -1 -1 -1 // LATIN SMALL LETTER Y, LATIN CAPITAL LETTER Y, <none>, <none>, <none>17 U 1 u U -1 -1 -1 // LATIN SMALL LETTER U, LATIN CAPITAL LETTER U, <none>, <none>, <none>18 I 1 i I -1 -1 -1 // LATIN SMALL LETTER I, LATIN CAPITAL LETTER I, <none>, <none>, <none>19 O 1 o O -1 -1 -1 // LATIN SMALL LETTER O, LATIN CAPITAL LETTER O, <none>, <none>, <none>1a P 1 p P -1 -1 -1 // LATIN SMALL LETTER P, LATIN CAPITAL LETTER P, <none>, <none>, <none>1b OEM_4 0 0025 0040 -1 -1 -1 // PERCENT SIGN, COMMERCIAL AT, <none>, <none>, <none>1e A 1 a A -1 -1 -1 // LATIN SMALL LETTER A, LATIN CAPITAL LETTER A, <none>, <none>, <none>1f S 1 s S -1 -1 -1 // LATIN SMALL LETTER S, LATIN CAPITAL LETTER S, <none>, <none>, <none>20 D 1 d D -1 -1 -1 // LATIN SMALL LETTER D, LATIN CAPITAL LETTER D, <none>, <none>, <none>21 F 1 f F -1 -1 -1 // LATIN SMALL LETTER F, LATIN CAPITAL LETTER F, <none>, <none>, <none>22 G 1 g G -1 -1 -1 // LATIN SMALL LETTER G, LATIN CAPITAL LETTER G, <none>, <none>, <none>23 OEM_7 0 0027 0022 -1 00a8@ -1 // APOSTROPHE, QUOTATION MARK, <none>, DIAERESIS, <none>24 H 1 h H -1 -1 -1 // LATIN SMALL LETTER H, LATIN CAPITAL LETTER H, <none>, <none>, <none>25 J 1 j J -1 -1 -1 // LATIN SMALL LETTER J, LATIN CAPITAL LETTER J, <none>, <none>, <none>26 K 1 k K -1 -1 -1 // LATIN SMALL LETTER K, LATIN CAPITAL LETTER K, <none>, <none>, <none>27 L 1 l L -1 -1 -1 // LATIN SMALL LETTER L, LATIN CAPITAL LETTER L, <none>, <none>, <none>28 OEM_1 4 003b 003a -1 00f1 00d1 // SEMICOLON, COLON, <none>, LATIN SMALL LETTER N WITH TILDE, LATIN CAPITAL LETTER N WITH TILDE29 OEM_2 0 003f 0021 -1 00ba 00aa // QUESTION MARK, EXCLAMATION MARK, <none>, MASCULINE ORDINAL INDICATOR, FEMININE ORDINAL INDICATOR2b OEM_5 4 007c 0024 -1 00e7 00c7 // VERTICAL LINE, DOLLAR SIGN, <none>, LATIN SMALL LETTER C WITH CEDILLA, LATIN CAPITAL LETTER C WITH CEDILLA2c Z 1 z Z -1 -1 -1 // LATIN SMALL LETTER Z, LATIN CAPITAL LETTER Z, <none>, <none>, <none>2d X 1 x X -1 -1 -1 // LATIN SMALL LETTER X, LATIN CAPITAL LETTER X, <none>, <none>, <none>2e C 1 c C -1 -1 -1 // LATIN SMALL LETTER C, LATIN CAPITAL LETTER C, <none>, <none>, <none>2f V 1 v V -1 -1 -1 // LATIN SMALL LETTER V, LATIN CAPITAL LETTER V, <none>, <none>, <none>30 B 1 b B -1 -1 -1 // LATIN SMALL LETTER B, LATIN CAPITAL LETTER B, <none>, <none>, <none>31 OEM_3 0 007e 0026 -1 -1 -1 // TILDE, AMPERSAND, <none>, <none>, <none>32 N 1 n N -1 -1 -1 // LATIN SMALL LETTER N, LATIN CAPITAL LETTER N, <none>, <none>, <none>33 M 1 m M -1 -1 -1 // LATIN SMALL LETTER M, LATIN CAPITAL LETTER M, <none>, <none>, <none>34 OEM_COMMA 0 002c 0023 -1 -1 -1 // COMMA, NUMBER SIGN, <none>, <none>, <none>35 OEM_PERIOD 0 002e 002a -1 -1 -1 // FULL STOP, ASTERISK, <none>, <none>, <none>39 SPACE 0 0020 0020 -1 -1 -1 // SPACE, SPACE, <none>, <none>, <none>53 DECIMAL 0 002e 002e -1 -1 -1 // FULL STOP, FULL STOP, , ,DEADKEY 00b40061 00e1 // a -> á0065 00e9 // e -> é0069 00ed // i -> í006f 00f3 // o -> ó0075 00fa // u -> ú0079 00fd // y -> ý0041 00c1 // A -> Á0045 00c9 // E -> É0049 00cd // I -> Í004f 00d3 // O -> Ó0055 00da // U -> Ú0059 00dd // Y -> Ý0020 00b4 // -> ´DEADKEY 00a80061 00e4 // a -> ä0065 00eb // e -> ë0069 00ef // i -> ï006f 00f6 // o -> ö0075 00fc // u -> ü0041 00c4 // A -> Ä0045 00cb // E -> Ë0049 00cf // I -> Ï004f 00d6 // O -> Ö0055 00dc // U -> Ü0079 00ff // y -> ÿ0020 00a8 // -> ¨KEYNAME01 Esc0e Backspace0f Tab1c Enter1d Ctrl2a Shift36 "Right Shift"37 "Num *"38 Alt39 Space3a "Caps Lock"3b F13c F23d F33e F43f F540 F641 F742 F843 F944 F1045 Pause46 "Scroll Lock"47 "Num 7"48 "Num 8"49 "Num 9"4a "Num -"4b "Num 4"4c "Num 5"4d "Num 6"4e "Num +"4f "Num 1"50 "Num 2"51 "Num 3"52 "Num 0"53 "Num Del"54 "Sys Req"57 F1158 F127c F137d F147e F157f F1680 F1781 F1882 F1983 F2084 F2185 F2286 F2387 F24KEYNAME_EXT1c "Num Enter"1d "Right Ctrl"35 "Num /"37 "Prnt Scrn"38 "Right Alt"45 "Num Lock"46 Break47 Home48 Up49 "Page Up"4b Left4d Right4f End50 Down51 "Page Down"52 Insert53 Delete54 <00>56 Help5b "Left Windows"5c "Right Windows"5d ApplicationKEYNAME_DEAD00b4 "ACUTE ACCENT"00a8 "DIAERESIS"DESCRIPTIONS0409 QWERT^(VK code, Modifiers and Symmetrical numbers) - CNLANGUAGENAMES0409 Chinese (People's Republic of China)ENDKBD