Thema: Delphi keyboard layout

Einzelnen Beitrag anzeigen

Olli
(Gast)

n/a Beiträge
 
#7

Re: keyboard layout

  Alt 9. Jan 2007, 01:11
Zitat von chukalv:
Well, I misunderstood You and myself.
The idea to simulate the language hotkey works fine. If someone presess my registered hotkey, I`m sending the windows language hotkey to the program and the keyboard layout changes. It works fine.
But if I wan't to change the keyboard layout without the hotkey? Meaning not to change only one step forward but to change it directly to another keyboard layout. I`ve made that my program finds out what keyboard layout is using the program, but I can`t find out how to change it... Maybe there are some possibilities to call the ActivateKeyboardLayout function to the active program?
Hint: a hook runs inside the process (and thread) which handles a certain window messages. This means you can use this to your advantage since you can call anything from within your hook function (such as checking the current layout and changing it to your needs).

The only problem: hooks are event based. So if you think it is no overkill to load your (hook) DLL into any running GUI application, it would be a way to check the current window receiving a message (such as WM_CHAR), if it is of the window class (e.g. EDIT or TEdit or TMemo) you want to process, you can check what is the current thread's keyboard layout and change it if needed.
  Mit Zitat antworten Zitat