Changing the keyboard for always?

by Michael S. Kaplan, published on 2007/05/04 00:41 -04:00, original URI:

(The inspiration for the title is from a Buck Rogers episode from the second season that I doubt anyone will recall!)

Craig's question was:

How do you change the Keyboard input local correctly? We need to change it in all process, but looks like LoadKeyboardLayout works only for the current process. How do you change the keyboard input type for the whole system ?

Now there is no way to change it for the whole system (which implies all of the users on it!), but there is an easy way to set the default input language that will be used for every new process that a user starts -- just use the SystemParametersInfo function with SPI_SETDEFAULTINPUTLANG.

In fact, that call is the same one that is set when you set the Default Input Language in the Text Services and Input Languages dialog.

Of course that call to SystemParametersInfo needs an HKL, so you probably would want to hold onto that LoadKeyboardLayout code to get the HKL to use. But at least it will let that keyboard be the one that is used by default in every new process....


This post brought to you by Ձ (U+0541,a.k.a. ARMENIAN CAPITAL LETTER JA)

Lars Viklund on 4 May 2007 6:33 AM:

When reading this post, was it just me that recalled Raymond Chen's "What if two programs did this?" blog post?

Paul Yates on 11 Aug 2009 10:17 AM:

And what about existing threads under the current user's session?

Basically within the corporate I work for we want to mange the input language setting automatically for travelling user's, so if a user from France (azerty keyboard layout) comes to the UK, their roaming profile will have the UK keyabord added as the new default.

This I can manage, with SystemParametersInfo (win xp enviroment), however the SPIF_SENDCHANGE flag doesn't seem to affect existing threads (e.g. Winlogon).

Anyone got any ideas?

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