Adding keys to your layout when you don't know what they are (aka Life with a 108-key keyboard layout)

by Michael S. Kaplan, published on 2008/06/27 03:01 -04:00, original URI:

Robert asked via the Contact link:

Dear Mr. Kaplan,

I just found an interesting story on your blog, namely .

I own a Japanese Windows Vista laptop, it has the typical Japanese Laptop Layout of 108 keys, that is 2 Alt keys, Hiragana/Katakana/Romaji key, Half-width/Full-width/Kanji key, 2 Control keys and the usual Windows keys plus Fn key.

However, it features a yen sign key and a backslash key. The one next to backspace is indeed the yen sign and another one (backslash and underscore next to right shift key) has an actual backslash imprinted on it.

This is all very good, however, if I ever wanted to type a real yen sign in alphanumeric mode (of the Japanese IME), I would indeed be typing a backslash that looks like a yen sign only in the Japanese locale. Everywhere else it would look like a backslash!

I wanted to change this behavior by setting the yen sign key to use the proper Unicode value for the yen sign. I tried Microsoft Keyboard Layout Creator 1.4, but I cannot have the layout match my keyboard at all; though the keys do work in testing mode, thought they are not assignable!

I tried your clue and save the layout as a .klc file, and indeed and very much so I could probably add the proper support in for having a seperate yen sign key and backslash key, giving those keys their proper values according to unicode.

However, as the special Japanese keys don`t work in MSKLC 1.4, they are not in the file and I could not find them in winuser.h. Secondly, I checked with a precompiled Windows executable for what the keys actual keycodes are, but those change depending on what operation they are ared for, e.g. changing to/from Hiragana to Katakana, changing to/from Kana keyboard mode, changing to/from half-width, full-width etc. are all different transitions codewise.

Currently it seems it is always a US-Layout of sorts (what the Japanese layout is derived from...), but hence it doesn`t feature the keys for input mode changing and I did not seem to find those VK names/values anywhere for Windows.

Is there any way in which I can obtain a .klc with all the codes already like in the standard Japanese keyboard layout?
Or if there is not, are the key codes for the VK keys at least noted somewhere with their respective transitions?
Also, if I actually could find them, would I be able to compile it with MSKLC 1.4, or would it skim those settings out of the final dll?

The post that Robert saw was In case you have a yen to extend your keyboard (or at least want a yen?).

Now MSKLC is of some use when this kind of forensic work is going on since it works to interrogate the keyboard, but it only looks up information for scan code it knows about -- and it is likely that it does not know about this key....

(This is kind of like what we were doing in Tracking down problems with the 102 key on an Acer Tablet with the UK Extended keyboard layout?)

You can basically take code like the bit I put into Handling [Unicode] input in the console and use it to get the scan code value of any of the keys.

From there, you can look at examples like this one or this other one for the MSKLC syntax for the .KLC file, since all you need to start the line with is a scan code and a virtual key (the scab code you get from the above. the VK you just have to pick a unique one).

Now this key is not one you would be able to necessarily edit in MSKLC since if the tool does not know about the scan code, it can't show the key.

But if you have the row correct in the .KLC file, you will be able to build and use the keyboard just fine! :-)

If you try this out (or at least that first part where you get the scan code), let me know what that other key does -- I am very curious whether the keyboard hardware vendor ever worked with Microsoft to define this keystroke so that it could be used....


This post brought to you by | (U+007c, a.k.a. VERTICAL LINE)

Mihai on 27 Jun 2008 12:18 PM:

Chinese Simplified - NeiMa has a Unicode mode, and it is still present in Vista.

Michael S. Kaplan on 27 Jun 2008 12:34 PM:

I think you meant that for one of the other blogs rather than this one, right? :-)

John Cowan on 1 Jul 2008 3:49 PM:

It's curious that I've never thought of you as "Mr. Kaplan" before, but I was rereading "O Kaplan! My Kaplan!" the other day, and then checked this post for comments, and, well...

referenced by

2008/06/27 How does it work? It cheats, that's how!

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