Change Keyboard Layout
Publicado: 04 Feb 2016 16:41
por mahdi1993
Hi to all
Everybody know how can switch between keyboard layout ?
For example on my system 2 language and keyboard layout are installed
1) English
2) Japan
Now i want when user focus in "input1" windows keyboard change to English
And when user focus in "input2" windows keyboard layout change to Japan
thanks!
Re: Change Keyboard Layout
Publicado: 05 Feb 2016 11:46
por mahdi1993
Hi to all
I found my problem solution
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Part 1)
KeyboardLayout = DLL.CallFunction("user32.dll", "GetKeyboardLayout", "0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
Above code return the current keyboard layout. for example when run above code if current keyboard is "English-US", 62699721 will returned or if current keyboard is "Persian", -255851479 will returned.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Part 2)
A = "-255851479";
DLL.CallFunction("user32.dll", "ActivateKeyboardLayout", ""..A.." ,0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
Above code active a keyboard. in above example variable A is contain Persian keyboard layout code and when called, keyboard switch to Persian layout.