找回密码
 加入
搜索
查看: 5148|回复: 2

[系统综合] 如何判断输入法是中文还是英文状态?[已解决]

[复制链接]
发表于 2016-9-21 23:09:42 | 显示全部楼层 |阅读模式
本帖最后由 cashiba 于 2017-3-18 09:42 编辑

点击托盘语言栏,有如下输入法:
[/quote]

注册表里输入法Keyboard Layouts里键名很多。删除无关的后,如下:
[quote]

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000409]
"Layout Text"="US"
"Layout Display Name"="@%SystemRoot%\\system32\\input.dll,-5000"
"Layout File"="KBDUS.DLL"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000804]
"Layout Text"="Chinese (Simplified) - US Keyboard"
"Layout Display Name"="@%SystemRoot%\\system32\\input.dll,-5072"
"Layout File"="KBDUS.DLL"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E00E0804]
"IME File"="IMSC40A.IME"
"Layout Text"="中文 (简体) - 微软拼音"
"Layout File"="kbdus.dll"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E0200804]
"Ime File"="SOGOUPY.IME"
"Layout Text"="中文 (简体) - 搜狗拼音输入法"
"Layout File"="kbdus.dll"

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 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
 楼主| 发表于 2016-9-24 22:23:51 | 显示全部楼层
AHK里讲的狠仔细,不过有点看不懂......
http://ahk8.com/thread-3751.html
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-22 15:56 , Processed in 0.083339 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表