受 @
sona #4 的启发,这是我的方案,用 Autohotkey 2 将微软拼音输入法锁在中文模式。这样唯一的快捷键就只剩下 Win + Space 了。
```
#Include %A_ScriptDir%
timeInterval := 500
GetImeState(id) {
return SendMessage(0x283, ; WM_IME_CONTROL
; 0x005, ; IMC_GETOPENSTATUS
0x001, ; wParam IMC_SETCONVERSIONMODE
0, ; lParam (NoArgs)
, ; Control (Window)
id)
}
SwitchImeState(id) {
SendMessage(0x283, ; WM_IME_CONTROL
; 0x006, ; IMC_GETOPENSTATUS
0x002, ; wParam IMC_SETCONVERSIONMODE
1025, ; lParam (Chinese)
, ; Control (Window)
id)
}
DetectHiddenWindows True
outer:
Loop {
try {
hWnd := WinGetID("A")
} catch as e {
; ^Esc 开始菜单弹窗,会卡死在找不到当前窗口
continue("outer")
}
id := DllCall("imm32\ImmGetDefaultIMEWnd", "Uint", hWnd, "Uint")
if (GetImeState(id) == 0) {
SwitchImeState(id)
}
}
```