定義'按鍵在單擊時(shí)切換到中文輸入法,雙擊時(shí)切換到英文:
SwitchIME(dwLayout)
{
HKL := DllCall("LoadKeyboardLayout", Str, dwLayout, UInt, 1)
ControlGetFocus, ctl, A
SendMessage, 0x50, 0, HKL, %ctl%, A
}
SwitchToEngIME()
{
SwitchIME(00000409) ; 英語(美國) 美式鍵盤
; Warn("English Now",200,150)
}
en:
SwitchToEngIME()
return
~'::
if (A_PriorHotkey = "~'" and A_TimeSincePriorHotkey < 400)
{
gosub en
}
return
HotKey, `', cn
cn:
SwitchToCnIME()
return
SwitchToCnIME()
{
SwitchIME(00000804) ; 中文(中國) 簡(jiǎn)體中文-美式鍵盤
; Warn("Chinese Now",200,150)
}
SwitchIME(dwLayout)
{
HKL := DllCall("LoadKeyboardLayout", Str, dwLayout, UInt, 1)
ControlGetFocus, ctl, A
SendMessage, 0x50, 0, HKL, %ctl%, A
}