|
楼主 |
发表于 2016-9-21 23:12:28
|
显示全部楼层
这段代码米看懂,不知道怎么改.....
Opt("WinTitleMatchMode", 4)
Run("notepad.exe")
Sleep(500)
$hWnd = WinGetHandle("classname=Notepad")
;~ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts
$KeyStr=_GetKeyboardLayout($hWnd)
$KeyName=RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\" & $KeyStr, "Layout Text")
MsgBox (0, $KeyStr, $KeyName);显示当前输入法
LoadKeyboardLayout("E0200804", $hWnd);设为搜狗拼音输入法 你应该先确认输入法是否已安装
Func _GetKeyboardLayout($hWnd)
Local $ret = DllCall("user32.dll", "long", "GetWindowThreadProcessId", "hwnd", $hWnd, "ptr", 0)
$ret = DllCall("user32.dll", "long", "GetKeyboardLayout", "long", $ret[0])
Return Hex($ret[0], 8)
EndFunc
Func LoadKeyboardLayout($sLayoutID, $hWnd)
Local $WM_INPUTLANGCHANGEREQUEST = 0x50
Local $ret = DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", $sLayoutID, "int", 1 + 0)
DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hWnd, "int", $WM_INPUTLANGCHANGEREQUEST, "int", 1, "int", $ret[0])
EndFunc ;==>LoadKeyboardLayout |
|