Link to home
Start Free TrialLog in
Avatar of ketsh
ketsh

asked on

Change Keyboard Layout for User / System

Hi,

I want to change user Keyboard Language setting for user / System.

i tried using ActivateKeyboardLayout and LoadKeyboardLayout API. But those work specific to current process.

Also i triled using SetLocaleInfo API but i couldnt make it work.
I'm using Windows 2000. And there are 4 languages installed on my mahcine. For ex. English , Spanish , german,  norwegian. As user selects a language in my application i need to set the same for complete OS or user profile. As other applications also need to access the same language.

Any solution?

Avatar of David Lee
David Lee
Flag of United States of America image

This is controlled by a registry setting.  Have your program change the associated value in the registry.
http://www.winnetmag.com/Article/ArticleID/14867/14867.html
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ketsh
ketsh

ASKER

Hi,
Thanks for code and reference.
But this will work only during logon.
My situation is application is running and user switches the language.
Lets take a example.
I have a application running say which is Calendar application. In this application user has option to change language. And there is another application running on machine say Ms-Word. Now if user is doing entry in my application using Spanish , he does Alt + Tab then Ms-word typing should also be in Spanish. At the same instance user can again switch back to English or German as per his requirement.

Please let me know anything for above scnerio.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ketsh, keyboard layout, since Windows 95, is process dependent. So, every process running on system can have different keyboard layout.
In order to make a global keyboard layout, you must use "System wide" keyboard hook - but this is not an option in VB. Keyboard hook function must be in separate DLL file written in C for example - DLL that exports functions, not Objects (Like VB DLL does). This keyboard hook function must have an option to send messages to external application, and receive messages from it in order to change pressed key code. Use search engine to find some keyboard hook DLL that fit your needs.
As I know, some of "KeyLoggers" are "shipped" with such DLL file - so, search for "key logger" and some help file for it usage :)