 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
twhyman
Joined: 07 Dec 2005 Posts: 218
|
Posted: Wed Oct 31, 2007 9:47 am Post subject: How to find out what is the current keyboard layout? |
|
|
Hi,
I am using an english and hebrew keyboard.
is there a way to know what is the current selected language in the language bar? EN or HE?
Thanks
Twhyman |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 265 Location: Russia
|
Posted: Wed Oct 31, 2007 12:26 pm Post subject: |
|
|
| Code: |
F11::
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "Int", WinID, "Int", 0)
InputLocaleID:=DllCall("GetKeyboardLayout", "Int", ThreadID)
MsgBox, %InputLocaleID%
Return |
|
|
| Back to top |
|
 |
twhyman
Joined: 07 Dec 2005 Posts: 218
|
Posted: Wed Oct 31, 2007 1:32 pm Post subject: |
|
|
thanks alot for the help
is there a way to also change the layout using dllcall?
thanks
Twhyman |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Wed Oct 31, 2007 3:11 pm Post subject: |
|
|
Based on that outcome I'd be more than interested to know how to [url]set[/url] the keyboard layout (and set/get additional Regional Settings if possible - to be able to create unattended setups/reconfigurations).
Any help on that would be much appreciated.
Thx for listening.  |
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 41
|
Posted: Wed Oct 31, 2007 6:34 pm Post subject: |
|
|
Keyboard layout for a specific window:
| Code: | IniRead, BG, %A_ScriptDir%\%1%, TRAFL, BG, 0x00000402
IniRead, EN, %A_ScriptDir%\%1%, TRAFL, EN, 0x00000809
IniRead, FR, %A_ScriptDir%\%1%, TRAFL, FR, 0x0000040C
IniRead, RU, %A_ScriptDir%\%1%, TRAFL, RU, 0x00000419
IniRead, SP, %A_ScriptDir%\%1%, TRAFL, SP, 0x0000040A
If T = BG
SendMessage, 0x50, 0, %BG%, Edit1, TRAFL_E
Else If T = EN
SendMessage, 0x50, 0, %EN%, Edit1, TRAFL_E
Else If T = FR
SendMessage, 0x50, 0, %FR%, Edit1, TRAFL_E
Else If T = RU
SendMessage, 0x50, 0, %RU%, Edit1, TRAFL_E
Else If T = SP
SendMessage, 0x50, 0, %SP%, Edit1, TRAFL_E |
; Keyboard Layout Codes
; ================================================
; [HKEY_CLASSES_ROOT\Mime\Database\Rfc1766]
; [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes]
; "00000402"="bg"
; "00000409"="us"
; "0000040C"="fr"
; "00000419"="ru"
; "00000809"="uk" |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 265 Location: Russia
|
Posted: Thu Nov 01, 2007 6:22 am Post subject: |
|
|
I think Edit1 is not needed in the SendMessage commands above. Input locale is a thread characteristic, as you can see from my example, so sending it to the parent window would work as well. Also, using PostMessage seems more reasonable, according to this:
| MSDN wrote: |
This message is posted, not sent, to the application, so the return value is ignored.
|
As for other locale features, I have no experience in working with them, so can't help.  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sat Nov 03, 2007 2:45 am Post subject: |
|
|
I suppose the global setting, i.e. the one in the Control Panel, is sometimes more useful.
| Code: | DllCall("SystemParametersInfo","Uint", 0x0059, "Uint", 0, "UintP", hKL, "Uint", 0) ; SPI_GETDEFAULTINPUTLANG
MsgBox, % hKL
|
| Code: | hKL := 0x00000409
DllCall("SystemParametersInfo","Uint", 0x005A, "Uint", 0, "UintP", hKL, "Uint", 0) ; SPI_SETDEFAULTINPUTLANG
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|