MSKLC under Windows 10: Create custom keyboard layout which supports IME (input method) for Chinese and combined input in Spanish
Asked Answered
P

1

8

This question is originally posted by me in Microsoft Community at:

https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/msklc-under-windows-10-create-custom-keyboard/8c5a7137-d575-4247-8ab3-b4dd1e5fb437?tm=1495318604424

In summary: I have created a custom keyboard layout with Microsoft Keyboard Layout Creator 1.4 in Windows 10, it is working but only partially. It cannot:

  • combine two keystrokes into one to type a "combined letter", e.g, "¨"+"u" = "ü". It should not exist in Chinese but I want to achieve this.

  • type Chinese pinyin and Chinese punctuation. In MS pinyin IME, I can press shift to switch between Chinese pinyin mode and English mode. Under pinyin mode I can convert letters into pinyin and thus get Chinese characters, but my layout lacks this. And, if I press "," in Microsoft Pinyin in pinyin mode, it should give me ","(full length comma), but this layout is not able to do this.

I am thinking about two ways to solve this:

  • Substitute Microsoft Pinyin's keyboard layout to my layout(replace the English part of MS Pinyin with my layout)

  • Copy the pinyin part of MS pinyin to my layout.

So, how can I solve this?

Phoenician answered 22/5, 2017 at 21:21 Comment(0)
P
7

I have solved it.

For the first problem, you must define some "dead keys combinations". The details are explained here:

http://www.angelfire.com/planet/linguisticsisfun/Creating_a_Keyboard_Using_MSKLC.pdf

For the second problem, basically you do:

  1. Create your keyboard layout.

  2. Edit the .klc file with a Text Editor, to change the VK code mapping. That is because most of the applications in Microsoft Windows, when you press the hotkeys, detects VK code sent to OS, not the "key chars"(the characters output as you type in a text processing software). So in order to make the key chars of your keyboard layout to match with their VK code, you must do this manually. MSKLC will not change that for you. Some details here:

http://www.sensefulsolutions.com/2010/08/how-to-fix-keyboard-shortcuts-in-klc-eg.html

  1. Install the layout.

  2. Open your registry editor, enter HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\, find your new keyboard layout at the bottom (mine with name like a0000xxxx). Copy the dll file name. That is the DLL file containing your newly created keyboard layout info.

  3. Go back to the registry father branch, search the language you want to apply this layout, like Chinese or Spanish. You will find several variations with names alike, but the descriptions are self-explanatory and can help you differentiate them.

  4. Simplified Chinese uses KBDUS.dll, that means "keyboard layout for US keyboard". This will apply to MS Pinyin, too. Change this value to your copied DLL name, so that it will load your DLL next time the OS launches.

  5. Restart.

The result:

  1. I can type English and Chinese pinyin with Microsoft Pinyin with my custom keyboard layout, and I can navigate next/previous page with , and ..
  2. With this keyboard layout I can type Spanish special characters, like ï, á, ç, ñ and without switching to Spanish keyboard.
  3. Hotkeys in any software are working as expected, because now VK code are matched with letters printed on the keys.
Phoenician answered 6/6, 2017 at 11:48 Comment(5)
Another thing to note, is that the dll file is not compatible between machines, even between two Win 10 machines. I think it is due to the different compilation components in each computer; compile and package the .klc file to generate dll in each machine is necessary.Phoenician
Thank you so much for the details about the VK code! I spent a significant amount of time investigating my system to figure out why some of my shortcuts weren't working with my custom layout, now everything make sense :)Farah
Actually they could not make sense in all the cases. Different applications has their own rules mapping hotkeys and they are usually only QWERTY based, because it is really complicated.Phoenician
What are the dead keys for? for changing u to ü? Why don't you use ALT GR?Malcommalcontent
@Malcommalcontent sorry I wanted to say "define a dead-key combination". Yes in this combination I use Alt-Gr + "¨" + letter.Phoenician

© 2022 - 2024 — McMap. All rights reserved.