Not all keyboards are included in MSKLC's lists

by Michael S. Kaplan, published on 2005/04/16 14:40 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/04/16/408853.aspx


Yesterday, Ovate left a comment to my post What is my locale? Well, which locale do you mean? entitled Chinese locales and Dvorak. Not entirely ontopic and probably better for the suggestion box, but I am not going to judge too harshly. :-)

Ovate said:

Hi there, I type with Dvorak for the right hand. However the Chinese locale input method MS-Pinyin 98 that I need to use to type Chinese relies on the Qwerty layout. I need to be able to change this to the right hand Dvorak layout within the Chinese locale (I actually need to be able to do the same for Japanese)

I have downloaded a copy of MKLC (Microsoft Keyboard layout creator). However when I go to File\ load existing keyboard, it only displays Chinese (PRC) US keyboard option. This is not even a Chinese input method. I already have all the Chinese locals installed on my computer. Would anyone have any idea why the other Chinese input methods do not display or how I can locate them so that I can alter the keys to a Dvorak right hand layout. If I'm going about this totally the wrong way, please excuse the ignorance :-)

This is unfortunately an intentional filtering that is done in the Microsoft Keyboard Layout Creator.

Back when I first wrote MSKLC, the "Load Existing Keyboard Layout" functionality was intended to support every layout under the HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts subkey, but there were two problems with this:

Entries like the Chinese (PRC) US layout actually exist if you go to the Add Input Language dialog provided by the Text Services Framework team, as you can see below.

And those entries are the only ones that MSKLC can actually get good information out of using the standard keyboarding APIs. If you look at the entries in the registry for the IMEs, they look like this:

Now obviously the "Layout File" is the keyboard DLL that is used. But the rules for the IME-attached DLLs are different. For example the Japanese file actually forwards to different DLLs depending on other system settings that are not documented, and the actual code in the IME has all different kinds of rules for reading the keyboard input, only some of which is Virtual Key-based and none of which is easily discerned with the keyboarding APIs. So in the end I hd to filter out those IME entries since I was unable to do anything with them.

Now in some cases, you can actually modify that Layout File setting to actually get the keyboard you want attached to the IME. In Ovate's case, the United States-Dvorak for right hand info can be found in the 00040409 entry:

So the layout file is KBDUSR.DLL. It may or may not work to change this value in the IMEs, mainly depending on what the IMEs themselves do to use the layout. But MSKLC could not really get in the business of modifying existing system configuration settings (for obvious reasons), since that is a sure recipe for disaster, even if it would always work.

So if you choose to make those kinds of changes in the registry, you are on your own. Be sure to save somewhere what the original settings were, by right-clicking on the registry key and choosing to export it to an .REG file:

so you can restore the old settings and recover from anything that does not work properly. If you do not and you mess up the IME beyond all repair, then be sure to tell the support person on the phone what you did, and don't get mad if they suggest that you reinstall Windows. :-)

 

This post brought to you by "" (U+1e30, a.k.a. LATIN CAPITAL LETTER K WITH ACUTE)


# Jim Gomes on 9 Jul 2005 9:08 PM:

Thank you for this great information! This is exactly what I was looking for. I was able to change the Japanese IME keyboard layout to a Dvorak layout by changing the registry database entries from KBDJPN.DLL to KBDDV.DLL. That's all it took, and it works great! Now I can enter the Romaji characters with a Dvorak layout. Thanks again.

# Jonathan on 6 Jan 2008 3:45 PM:

This works great. Except for MS Word 2007. Does anyone know how to get this work in office? My Pinyin keeps using qwerty while this works perfect in Notepad.

And I agree, Microsoft should allow users to choose keyboard layouts and IME separately in the control panel.

# Michael S. Kaplan on 6 Jan 2008 5:45 PM:

Office 2007 is using the TSF interfaces, so t he legacy ones and modifications thereof will not work, and there is no workaround with those IMEs in such platforms.

Sorry!

Morphiis on 21 Jun 2010 6:29 PM:

For MS Office 2007 which uses TSF interface, you need to change the layout file for language, not just for the IME.

For example, if you want to use dvorak for Chinese IME, you need to change the layout for 0000804, not just for E0XX0804, where E0XX0804 is the registry entry for Chinese IME


referenced by

2008/02/22 What's missing from the model

2007/10/25 Ding dong, the hack is gone (aka Cutting the hacked cord, too)

go to newer or older post, or back to index or month or day