by Michael S. Kaplan, published on 2007/07/26 03:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/07/26/4057259.aspx
Over in the Suggestion Box, Olivier asked:
We created Keyboard layouts for our own specific keyboards, and on Windows Vista when we look at the Keyboard Layout Preview in the Add Input language dialog, the preview is mostly empty (only tab, Caps, Shift, Enter and BackSp keys show up). Is it because the keyboard layouts are custom and define extra keys??
Thanks for any suggestion or help.
Olivier
That preview dialog is one I have talked about before, if you will recall (just this last March in The T's are crossed, but not all of the I's are dotted...).
In that post I actually described how the preview get its data:
...the same info that feeds the GetKeyNameText function, which itself depends on the data that feeds the MapVirtualKeyEx function. In fact, when dealing with the function itself GetKeyNameText calls MapVirtualKeyEx twice:
- First with the MAPVK_VSC_TO_VK flag, mapping the scan code to a virtual key on the given keyboard
- Second with the MAPVK_VK_TO_CHAR flag, mapping the virtual key to a character
Interestingly enough (as I pointed out in that post), ignoring the odd bug the data it gets back is probably better than the more complex things pulled out by MSKLC. But then that preview's needs are different, so no shame in being better at its own needs!
In the particular case of Olivier's question, I am not sure what might be happening. The keys that work are of course ones that it populates from its own resources, but I don't know of a reason that the created keyboards would not have their keys showing....
I then had a chilling thought. Could it be a keyboard based on a custom culture created in MSKLC 1.4? Due to that strange LCID? Yikes, I hope not!
Okay, just tested that scenario out and everything worked.
Whew! That would have been pretty ugly if MSKLC were to break GetKeyNameText.
On the other hand, MSKLC was not explicitly mentioned so perhaps I am being paranoid. :-)
I guess I'll need some more details from Olivier at this point -- like the keyboard that repros the problem, or at least more details on how it was created.
Or is anyone else seeing this problem?
This post brought to you by ៘ (U+17d8, a.k.a. KHMER SIGN BEYYAL)
# David Tickle on 26 Jul 2007 5:10 AM:
I can reproduce the very same behaviour (minimal details displayed in the preview) with the keyboard layout provided by the free-to-download Apple Bootcamp.
# Michael S. Kaplan on 26 Jul 2007 11:48 AM:
Wow, that is interesting, and maybe gives some hints here....
That preview pane is relying on GetKeyNameText and scan codes, so if that hardware keyboard is doing anything different there, then the preview might not be able to see characters in the keys it checks.
I guess I might actually have to consider installing Boot Camp and Vista on my Mac now....
# Olivier on 26 Jul 2007 1:49 PM:
After more testing, it seems that this might be caused by the location where we install our layout DLLs. We install them somewhere under the Program Files folder and we correctly set the Layout File path in the registry.
Aftere mooving the layout DLLs to Windows\system32 and updating the Layout File path in the registry, the preview of the layout now works!
I thought that the layout DLLs could be installed anywhere, as long as the Layout File path was set the the DLL path. Can you confirm that the layout DLLs need to be installed in Windows\system32?
Thanks for your help!
Olivier
# Michael S. Kaplan on 26 Jul 2007 2:26 PM:
It is always better to install them there, and in some cases it is required. So I would probably recommend it (also, the only supported way to install MSKLC-generated layouts is via the installer we provide, which puts them there).
# Michael S. Kaplan on 26 Jul 2007 6:09 PM:
David, do you ahev any other info about the Boot Camp download keyboard repro? Or will it happen will all keyboards?
# Olivier on 26 Jul 2007 6:57 PM:
Bootcamp installs the keyboard layout DLLs under the Program Files\Boot Camp\Layout folder, so you will see this issue with Boot Camp. It also seems that the keyboard layout installed this way will not work at all in Vista. They will not show up in the language bar, even if you add them from the control panel. Changing the location to system32 for the keyboard layout DLLs fixes these issues.
Olivier
referenced by