Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function to select input-keyboard language
#1
I have written and use the following function to select an input-keyboard language :

Function Keyboard_Shift
Code:
Copy      Help
;/
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.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)