05-22-2016, 08:05 AM
I have written and use the following function to select an input-keyboard language :
Function Keyboard_Shift
I find it very useful because this function is called using two keyboard triggers, namely F11 to shift to greek and Shift+F11 to shift to Latin. This function works perfectly. However, I cannot understand the following issue, since I came to this solution almost empirically :
When I wrote the function, in the first place, I used to change keyboard language, in all applications :
Nevertheless, I experienced that Shift+F11 did not work in Excel files. I found empirically that
works in Excel and only in Excel.
I am just seeking an explanation about it and/or any better solution.
I hope that Gintaras will certainly advise as always. In anyway I am most obliged to him, for excellent, perfect, reliable and prompt advises.
Function Keyboard_Shift
;/
function int'sw [int'w] ;; 0 :shift to English, >=1 : Shift to Greek
int k l hwnd
,
hwnd=iif(w=0 win() w)
l=GetKeyboardLayout(GetWindowThreadProcessId(hwnd 0))
;out l
int lo=l&0xffff
k=iif(lo=1032 1 0)
;outt F"{sw} - {k} - {l} - {_s.getwintext(hwnd)}"
if sw <> k
,str exename.getwinexe(hwnd)
,if StrCompare(exename "EXCEL")=0
,,key CS ;; Ctrl+Shift
,else
,,SendKeysToWindow hwnd key((VK_LBUTTON) (VK_CONTROL) (VK_SHIFT))
I find it very useful because this function is called using two keyboard triggers, namely F11 to shift to greek and Shift+F11 to shift to Latin. This function works perfectly. However, I cannot understand the following issue, since I came to this solution almost empirically :
When I wrote the function, in the first place, I used to change keyboard language, in all applications :
Quote: SendKeysToWindow hwnd key((VK_LBUTTON) (VK_CONTROL) (VK_SHIFT))
Nevertheless, I experienced that Shift+F11 did not work in Excel files. I found empirically that
Quote: key CS ;; Ctrl+Shift
works in Excel and only in Excel.
I am just seeking an explanation about it and/or any better solution.
I hope that Gintaras will certainly advise as always. In anyway I am most obliged to him, for excellent, perfect, reliable and prompt advises.