How to make a Custom Keyboard layout? - windows

What's the best way to make a keyboard layout for Windows?
Specifically a layout that will appear in the 'Text Services and Input Languages' list and without buying expensive software.
I know about the Microsoft Keyboard Layout Creator but find it completely limited as you can't do simple things like remap the CapsLock key or the number keys.

You can build one yourself! A keyboard layout is basically a .DLL with a function that returns a table of assignments. The driver kit contains examples, and my Programmer Dvorak comes with source too (which is not derived from the DDK).

For remapping CapsLock or the number keys, use remapkey.exe found in the Windows 2003 Resource Kit Tools.
Keyboard layouts that show up in “Text Services and Input Languages” can’t remap CapsLock or do anything not supported by Microsoft Keyboard Layout Creator; the operating system just doesn’t support it. Anything that Microsoft can do with a keyboard layout, you can do with Microsoft Keyboard Layout Creator.

I realize that this thread is quite old and dead, but the answer provided is inaccurate.
You can do exactly what you want to do with KbdEdit. It is not free, but it is not expensive by any means, and there are several versions with varying features.
I would also like to point out that despite the claims of the highest rated answer, the operating system, in fact, most certainly DOES support a multitude of complexities and customizations which MSKLC can not understand, process or support.
There are—and always have been—MANY features and behaviors of keyboards which are possible in Windows but which are impossible with MSKLC.
In a number of cases it is possible to create as much as possible with MSKLC and then modify the source file in a text editor and then to build the DLL using the command line tools supplied with MSKLC. But it is my understanding that at a certain point—with certain features—those tools can not even be used to generate working keyboards.
At this point you could turn to the driver development kit, but that is beyond my scope.
Fortunately, there's KbdEdit! It is extremely powerful, easy to use and it can change any key on most any keyboard to any other key—except for the "Pause" key, which is a Microsoft imposed restriction, but even that can be circumvented with AutoHotKey.
Cheers!

did you check the new version of Microsoft Keyboard Layout Creator, I think you can do many things with this new version like remapping keys.

I am a fan of Auto Hotkey, a free, small, non-fuzzy windows tool to assign macros to keys. If all you want is a few special characters like proper “Quotation Marks” —or em-dashes— this is great:
#NoEnv;
SendMode Input;
!1::
{
Send „
}
return
!2::
{
Send “
}
return

Related

Microsoft statement about Windows-key usage in the future?

Assigning keyboard shortcuts is very popular for automating tasks. AutoHotKey even makes it a one-liner.
When choosing hotkey combinations, we always need to be careful not to destroy shortcuts of any existing applications, especially if they can be assigned using the mechanisms of Winforms or WPF.
So the most safe key is probably the Windows key. However, Microsoft writes in the documentation of RegisterHotKey():
MOD_WIN 0x0008
Either WINDOWS key was held down. These keys are labeled with the
Windows logo. Keyboard shortcuts that involve the WINDOWS key are
reserved for use by the operating system.
And it's true that Microsoft adds more and more Windows-key-combinations to the operating system itself, as we have
E - Explorer
L - Lock screen
P - Presentation
M - Minimize
D - Desktop
R - Run
Tab - Switch
and probably others which I don't even use. Until now I haven't seen a Windows shortcut which uses additional modifiers such as Shift, Ctrl or Alt.
As I don't want to override existing shortcuts which users might already be familiar with, I have the following questions:
a) Is there a way to programmatically find out which Windows-shortcuts are defined by the OS?
And I mean Windows only here. Not shortcuts which are in use e.g. by OneNote (I especially don't like those) or AutoHotKey.
b) Is there any official Microsoft statement that they will try not to use modifier-Windows-shortcuts in the future?
Some modifier+Win shortcuts already exist, for example Win+Shift+Tab, Win+Shift+Arrow, and Win+Shift+digit.

Remap keys in OS X

Specifically I'm attempting to map my MacBook's fn key to left mouse click.
Back in the old days when I was using Windows, I came across a wonderful little utility that let me map anything to anything: http://www.autohotkey.com/
You create a little text file, e.g.
^!s:: ; CTRL + ALT + s
Send Sincerely,{enter}John Smith ; sends keystrokes to active window
return
Creating a simple text file was infinitely better than any GUI based remapper.
I can look through it and see everything that is going on at a glance
I can customise every last detail
I can save / retrieve / post / share my scripts
Really, it's the one thing I really miss about Windows.
So my question is: How do I go about doing this in OS X? Every Google search leads to https://pqrs.org/macosx/keyremap4macbook/ and I dislike this package: it has an insanely cluttered GUI.
I would be very happy if I could do it in a shell script, or even compile code.
HotKeys on OS X
Even though AHK is seemingly absent on Mac, the functionality that AHK provides on Windows can likely be achieved in OS X. It could be a matter of coding your own solution, modifying something that's open-source, or using a combination of applications that will work together. I haven't tried all of the following, but might as well mention them as they might be worth checking out:
Open Source
IronAHK - .NET rewrite of AHK ported to OS X
AHK Forum Thread
Github Project
*the original project might be dead
CliClick - command-line application that will emulate mouse clicks
Github Project
Commercial
TextExpander - scriptable text completion / hotkey / macro app (supports AppleScript, Shell scripts)
Typinator - similar to TextExpander, although some features vary.
KeyMo - mostly for mapping keys exclusively to your mouse.
FastScripts - maps hotkeys/user-definable keyboard shortcuts to AppleScripts
*I use Text Expander and FastScripts together and can't live without them.
Rolling Your Own
It's fairly easy to create something with an AppleScript, or a shell script for just about anything imaginable in OS X. For example, I've seen CliClick used along with a custom AppleScript to achieve a certain functionality that it might not provide otherwise. To find an AHK replacement on Mac it'll probably be through trial and error, patience, and ultimately what ends up working best for you.
It is possible with a program called ControllerMate, instructions here. It is, however, a commercial software. I'm also interested in finding a free alternative.
Sikuli project looks promising. Not sure about your particular problem (e.g. Fn key remapping), but it's definitely a crossplatform alternative to AHK.
Another Open Source solution to this problem not mentioned in l'L'l's answer is Karabiner; I have been looking for a way to remap the key to the left of 1 to Esc for a while, and this worked perfectly. It even resolved an issue I was having where swapping Cmd and Alt using the built in OSX key remapping was breaking terminal Alt shortcuts! Highly recommend it.

Detect specific key regardless of language setting

(Windows interop here)
Background:
ConEmu is a program I just found, very cool, allowing a lot of features for interacting with the command line. However, it has a "Quake" feature where you would hit a key and get a console dropping out of the top like in most FPS games. I found a bug where it would not work properly depending on the language setting of the user. You can check the bug report if you want to know about it.
Question:
Is there a way to hook a callback into a specific key (not character, but specific key on the keyboard), regardless of the language setting the user has?

Delphi problem with users using Arabic/Hijri calendar

Some of my Arabic users are reporting problems back to me with my application giving errors.
Common for them seem to be they are using Hijri calendar and TDateTimePicker control causing problems (but quite possibly it is the entire TDateTime and RTL that has problems, I am not sure)
The Hijri Calendar has a different year start/end which is not well suited for my application. (AFAIK, Hijri first became available in Windows7.)
I have problem reproducing the error because
1) I can't read Arabic making it much harder
2) I can only pick Hijri when Windows is set to Arabic (otherwise it is not a visible option)
Anyone here with the same problems? I Use Delphi 2010
Can I force my application into using standard calendar? (as solution) or can I force Windows to Hijri calendar on English Windows? (for testing)
In XP anyways, if you already have not done so, on Control Panel's Regional and Languages options dialog, go to the Languages page and first check the Supplemental Language Support checkboxes (Install files for complex script and right-to-left languages (including Thai)". For fun, check the East Asian languages one too, for later when you're going to want to check that chinese characters work properly.
Then, from the Control Panel, "Regional and Language Options" go to the "Advanced" tab and change the "Language for non Unicode programs" to an Arabic language.
Next you can go to date/calendar options and change to calendar type:
Hirji Calendar in arabic looks like this:
التقويم الهجري
Original source MSDN:
http://www.microsoft.com/middleeast/msdn/ArabicCalendar.aspx
Additional pro tip: If you aren't already doing so, start using VMs for internationalization testing. Do you really want to do all this to your main workstation? Not me. I do this stuff in VMs.
You can use the Windows API function SetLocaleInfo, this would change the user's settings in the windows control panel which may be undesirable.

Modifying the verbs for a file type in Vista

In XP, you can change the verbs for a file type (open, edit, print, etc) via Tools->Folder Options. I can't find this in the Vista.
I know there's a programmatic/registry-matic way to do it, but how does one change this in the UI? Googling didn't help me much.
The File Types tab was removed in Vista (and later versions) and there is no real replacement, the closest you can get is the Default Programs section in Control Panel but it does not give you the same control over the verbs, you can only pick from a fixed list provided by the products installed on your machine.
There is also a 3rd-party program called Default Programs Editor you could take a look at.

Resources