The advanced feature in MSKLC doesn't really scan

by Michael S. Kaplan, published on 2006/08/30 05:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/08/30/726087.aspx


Earier this month, Emerson asked me via the 'Contacting Michael' link:

Hello,

My name is Emerson, I'm from Brazil and I am kind of desperate. I have a question concerning the Microsoft Keyboard Layout Creator and I would like to know if you can help me on that.

Does the MSKLC really allow the changing of scan codes? The help says it's possible, but I just can't do it. The virtual keys with changed scan codes end up with two scan codes: the original one and the one I assigned by me. It would not be a problem if I could "build DLL and setup package" even that way, but when I try to do that, I get the following:

1) A message box appears. It says: "There was a problem building the keyboard file. Would you like to see warning/error information?". I click "Yes".

2) A message box titled "Standard output information" says: "Error 2020 (..\.\tmpLayout01.txt, line 74): VK_OEM_2 (bf) found at scancode 73 and 35." I click OK.

That's it. Obviously some paramaters from the second message box may vary according to the keys I try to change the scan code. By the way, to change the scan code I right-click on the key I want, click on "Properties for VK_ in all shift states", click on the check box for "Advanced View", change the scan code for whatever I want and finally click OK.

The layout may work with no problems on that text box and it also may be validated with no errors (only warnings) -- it does not matter, it seems impossible to build the DLL and setup package.

Am I doing something wrong? What would you recommend me to do?

Oh, by the way, I'm using a Japanese laptop (that's why I want to change some scan codes -- basically adding scan code 73 over some other not used by my keyboard) with Windows XP Service Pack 2 (Brazilian, slipstreamed).

Actually the only problem I have with this laptop is that I can't type diacritics properly, because the Japanese layout has no dead keys. Since MSKLC does not handle the Japanese layout properly, I found that the best way to get the keyboard working the way I want would be changing some scan codes and adding the dead keys with MSKLC. Also it would be useful if I could change the virtual key name, so the old scan code could keep with the original virtual key, and I would put a new scan code for a new virtual key.

Sorry for the big message, hope you can help me. Keep the good work up.

Thanks in advance.

Regards,

Emerson

Ok, I think we're going to have one of those awkward moments now. :-)

The dialog Emerson is referring to is this one:

(I am using the Greek polytonic keyboard in the examples here, by the way!)

With the Advanced view on, the Scan Code is available to be set, in this case it is 0x1b (or as it is shown in the dialog, 1b).

Now if you take a keyboard, save it out as a .KLC file, and then open that .KLC file in Notepad, you will see (among other things) a table that looks something like this, with one row per key:

//SC VK_   Cap  0     1     2    6     7
//-- ----  ---- ----  ----  ---- ----  ----
19   P      1   03c0  03a0  -1   -1    -1
1a   OEM_4  0   005b@ 007b@ -1   00ab@ -1
1b   OEM_6  0   005d@ 007d@ -1   00bb@ 0387

and so on.

Note how the first column is the scan code, and the second column is the virtual key. Essentially this mapping is built entirely from scratch by MSKLC, based on some keyboard layout.

When we discussed the user interface, initially we wanted to just hide the whole thing, as every method we tried to work out to let people adjust the VK values just got us in trouble with usability. We finally ended up putting in this obscure method to switch scan codes around a bit, which is mostly useless. Since it is up to the hardware keyboard layout where the actual scan codes sit (the keys are the ones that emit the scan codes), being able to switch them would just make people feel better if they wanted to feel like they were moving stuff around.

Which I knew was kind of dumb even back then, but only realized how dumb when I was playing with the feature as research when writing this article. MSKLC sharply limits stuff like putting in both new scan codes and higher valued scan codes (which is what Emerson is trying to do).

Given that it is useless in its current form and that MSKLC blocks most of what would be legitimately useful (but which never occurred to anybody to ask for while it was being developed and tested), I think it would be a good idea to just treat the whole scan code "feature" in MSKLC as being completely broken and get a bug in to try and fix this in a future version....

In the meantime, the only real workaround would be to do some of the work manually. Not for the faint of heart, but I think I can put together an example as an upcoming advanced blog post over the weekend? :-)

 

This post brought to you by  (U+30bb, a.k.a. KATAKANA LETTER SE)


Emerson on 2 Sep 2006 4:12 PM:

Hello, Michael. Thanks for answering my question!
I would not mind working on this issue manually. Actually, I would love doing that.
Does it have anything to do with opening the KLC file on notepad?
Well, I'll wait for the post with the solution. Thanks again.

Arno on 14 Jul 2011 1:43 AM:

Dear Michael,

I do not understand what "Error 2020 (..\.\tmpLayout01.txt, line 74): VK_OEM_2 (bf) found at scancode 73 and 35."

really means. or in my case "... Line 70 VK_OEM_5 (dc) found at scancode 29 and 2b".

I opened the .klc-file in an editor and see OEM_5 only at 29. I left 2b empty in order to avoid trouble.

Background: I want to make a ethiopic keyboard -- of course with looots of dead keys. Looks nice in MSKLC, but

am stuck with this error message, which too me still is incomprehensible.

I have nothing against tweaking manually, but how?

Thanks


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