Autor Beitrag
chukalv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mi 27.12.06 08:15 
Are there any components (or ways) to change the keyboard layout language system wide? And to install new layouts?
I found this one, but it`s not working to me. Found some other components like KbdLayout, but it only changes the layout in the application. Found out that there`s a component that retrieves the installed layouts - KeyboardLayout. But how to change them system wide and install new ones?
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Do 28.12.06 12:04 
user profile iconchukalv hat folgendes geschrieben:
Are there any components (or ways) to change the keyboard layout language system wide? And to install new layouts?
I found this one, but it`s not working to me. Found some other components like KbdLayout, but it only changes the layout in the application. Found out that there`s a component that retrieves the installed layouts - KeyboardLayout. But how to change them system wide and install new ones?


Hello,

it is true that there is almost nothing to be found - it seems absolutly unusual to let a single application change the keybord system wide. I think this has good reasons.

If you are sure that you should it do anywhere, the only way i can see is:

1. exchange the keyboard in the usual way with settings - system control - keyboard.
2. look in the registry what changes are made.
3. let your program change the registry accordingly.

s.y. Reinhard
chukalv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Fr 29.12.06 11:35 
OK, made some self research. When I use the Control panel->Regional and language options->Languages (windows XP), the system itself changes the registry here:
ausblenden Quelltext
1:
HKEY_CURRENT_USER\Keyboard Layout\Preload					

That`s the way the language is changed. The first one record is the default language that`ll be used in software. All the other records in this key are the other languages installed on the system. All the language codes You can find here.. The language changes perfect after logout and login.
But how to change the language dinamically (meaning without any logout and login)? Have no clue by now how to do that..

P.S. Trying to make this for creating an easy using language bar for myself..
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Fr 29.12.06 16:37 
user profile iconchukalv hat folgendes geschrieben:
OK, made some self research. When I use the Control panel->Regional and language options->Languages (windows XP), the system itself changes the registry here:
ausblenden Quelltext
1:
HKEY_CURRENT_USER\Keyboard Layout\Preload					

That`s the way the language is changed. The first one record is the default language that`ll be used in software. All the other records in this key are the other languages installed on the system. All the language codes You can find here.. The language changes perfect after logout and login.
But how to change the language dinamically (meaning without any logout and login)? Have no clue by now how to do that..

P.S. Trying to make this for creating an easy using language bar for myself..


Hello,

read in SDK help: ActivateKeyboardLayout

I think this is what you need.

S.Y. Reinhard
chukalv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Fr 29.12.06 17:25 
Zitat:
read in SDK help: ActivateKeyboardLayout
I think this is what you need.


The ActivateKeyboardLayout function sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process...
Already knew that, but it also changes the keyboard layout only for my application, not system-wide...
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Sa 30.12.06 17:13 
user profile iconchukalv hat folgendes geschrieben:
Zitat:
read in SDK help: ActivateKeyboardLayout
I think this is what you need.


The ActivateKeyboardLayout function sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process...
Already knew that, but it also changes the keyboard layout only for my application, not system-wide...


Sorry, you are right. I tried to find the point in the registry where the KL for a new program ist defined, but in the meantime i am quite sure, that this information is not in the registry at all, and within windows there is also no such thing as a system wide KL. My theory of operation is: there is a mechanism to setup a default KL for a user at Logon, and this KL is inherited by starting programs in the same way as the other environment (but there is no entry in the environment like a variable for the keyboard). Therefore you will encounter the same problems as with the environment: you can set your own one, but not the environment of other programs.

A already working program will use its own KL no matter what happens outside, so there is no way to switch the "system" without restarting all running programs. A new system or default KL would affect only programs starting in the future.

I tried to set the "system" KL by hotkeys with funny results: it is possible to have "EN" in the taskbar and nothing else running, but notepad (like all other programs) starts with "DE". The screen and the Taskbar itself may have their (may be different) KL, but i dont know from where a new process inherits its KL. I think that this cannot be altered after logon, because it behaves the same way as any other process in the system, which has a individual KL from startup.

sy Reinhard
chukalv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Sa 30.12.06 19:10 
Reinhard Kern: Actually, I agree with You that the information for the default keyboard layout information for an application before it`s opening could be not in the registry...
But. The information before log in IS in the regsitry, as I wrote before. And it IS possible to change a running application keyboard layout. The default windows language hotkeys and language bar is very bugy. But there a lot of software that changes the keyboard layouts for running programs perfect. Like the R-win.
Yet I haven`t found out how is this done.. Maybe by injecting a windows system dll, hooking the keyboard and changing the key codes or with another method. But it IS possible..
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: So 31.12.06 02:50 
user profile iconchukalv hat folgendes geschrieben:
Reinhard Kern: Actually, I agree with You that the information for the default keyboard layout information for an application before it`s opening could be not in the registry...
But. The information before log in IS in the regsitry, as I wrote before. And it IS possible to change a running application keyboard layout. The default windows language hotkeys and language bar is very bugy. But there a lot of software that changes the keyboard layouts for running programs perfect. Like the R-win.
Yet I haven`t found out how is this done.. Maybe by injecting a windows system dll, hooking the keyboard and changing the key codes or with another method. But it IS possible..


Hello,

i did not really mean that it is impossible at all - since any application can change the keyboard by itself (i said only that you cannot change it from "outside"), you could enumerate processes or threads, use AttachThreadInput and send a keyboard changing hotkey to the process. I am shure this is a way, but i did not verify it. Another way may be to call ActivateKeyboardLayout in the context of another process (a really secure operating system should not allow such things). But I think you have to do it for all running processes (or Threads) separately.

sy Reinhard