其实也没有完美的解决,只是把输入法先更改为中文输入法,再调整为中文输入法下的美式键盘。$hWnd = WinGetHandle("[ACTIVE]");$hWnd 为目标窗口句柄,这里设置的是当前活动窗口
$ret = DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", "E0210804", "int", 1 + 0)
DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hWnd, "int", 0x50, "int", 1, "int", $ret[0])
;再将 输入法更改为中文输入法下的美式键盘
$hWnd = WinGetHandle("[ACTIVE]");$hWnd 为目标窗口句柄,这里设置的是当前活动窗口
$ret = DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", "00000804", "int", 1 + 0)
DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hWnd, "int", 0x50, "int", 1, "int", $ret[0])
我这里的输入法是紫光输入法 对应E0210804 美式键盘 对应 00000804
现在还没有办法做到一步到位将输入法和键盘调整到自己想要的方式。
有大神可以做到的,给个思路。谢谢! |