2018-10-15 ahk 定义'按键在单击时切换到中文输入法,双击时切换到英文

定义'按键在单击时切换到中文输入法,双击时切换到英文:


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) ; 中文(中国) 简体中文-美式键盘
;    Warn("Chinese Now",200,150)
}

SwitchIME(dwLayout)
{
    HKL := DllCall("LoadKeyboardLayout", Str, dwLayout, UInt, 1)
    ControlGetFocus, ctl, A
    SendMessage, 0x50, 0, HKL, %ctl%, A
}

你可能感兴趣的:(2018-10-15 ahk 定义'按键在单击时切换到中文输入法,双击时切换到英文)