4

Im trying to configure the Language Bar (the language switcher in the systray which appears whan you have multiple input languages installed) for our users.

language bar

I can easily add new languages using regkeys below HKCU, but the problem is that the user has to relogin or reboot his computer to see the effect.

The keys i use (im writing them with an active setup) are in "HKEY_CURRENT_USER\Keyboard Layout\Preload" below that key are name/values of the type REG_SZ.

Usually there are already keys like "1"="0000407" "2"="0000409" which means the user has German and English keyboard layout installed, if i want to add, lets say italian, i would add the key "3"="0000410". after the next logoff/login the change is visible to the user.

now what i already tried is sending various windows messages, like WM_SETTINGCHANGE or the "RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters" command. but no usefull result so far.

im running out of ideas here, making hundreds of users logoff/logon wouldn't be so great :/

i also thought of automating mouseclicks (e.g. with autoit), but that usually causes more trouble than it does any good.

1

1 Answer 1

2

You should not be doing this through registry editing, since our knowledge on that is quite limited, but use the mechanism supplied by Windows.

Microsoft has created Windows PowerShell as its main programming interface which allows access to virtually every functionality in Windows. Unfortunately, the family of PowerShell functions that pertains to language, International Settings Cmdlets, was only introduced for Windows 8/Server 2012 and is not available for Windows 7 or Vista.

Nevertheless, solutions do exist for Windows 7 or Vista, as described in the MSDN article:
Windows Vista Command Line Configuration of International Settings.

An example of using this technique is to be found in Configuring Regional and Language Options International Settings with command line automation, which basically uses a specially crafted xml file with the command:

control intl.cpl,, /f:"intlsettings.xml"

Below are listed some example xml files.

Change the current language

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
    <!--User List-->
    <gs:UserList>
        <gs:User UserID="Current"/>
    </gs:UserList>
    <!-- User Locale-->
    <gs:UserLocale>
        <gs:Locale Name="es-US" SetAsCurrent="true"/>
    </gs:UserLocale>
</gs:GlobalizationServices>

Add keyboard language

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> 
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> 
<gs:InputPreferences> 
<gs:InputLanguageID Action="add" ID="0804:E0200804"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

Remove keyboard language

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> 
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> 
<gs:InputPreferences> 
<gs:InputLanguageID Action="remove" ID="0804:E0200804"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

source

5
  • i tried to do this without registry changes. instead i used the windows api (using LoadKeyboardLayout and ActivateKeyboardLayout). no success :/
    – weberik
    Aug 19, 2013 at 15:14
  • These functions affect the current keyboard layout, but not the language bar. For a good solution, you will need to bite the bullet and learn PowerShell. It is a lot to swallow, but there are many helpful resources on the Internet.
    – harrymc
    Aug 19, 2013 at 19:45
  • well i am familiar with powershell, but i could'nt find a ps native command. in the end i would only call windows api or wmi commands from ps, so it doesnt matter much if i use ps, csharp, batch or whatever. could you maybe point me to one of those 'helpful resources on the internet'?
    – weberik
    Aug 26, 2013 at 14:34
  • I thought that "International Settings Cmdlets" above were what you needed. As regarding PS, for starters google for "powershell tutorial" and you will have much more than you can read. Another google trick I use is "powershell filetype:pdf", which gave me for example this book. Microsoft is of course another great source.
    – harrymc
    Aug 27, 2013 at 17:59
  • oh, thanks, by now i found that cmdlets. unfortunately they are not available on our systems(Vista) :/
    – weberik
    Aug 28, 2013 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .