微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法更改ahk_class的输入语言#32770

如何解决无法更改ahk_class的输入语言#32770

我在PC上使用多种语言,并且经常使用自动热键在它们之间进行切换。

在一种情况下,我在弹出窗口中编写了一个脚本以切换为英语,以保存文件或网页,wintitle为ahk_class #32770。没用奇怪的是,相同的代码可用于ahk_exe Explorer.EXE窗口。

这是代码

#NoEnv  
#Warn 
SendMode Input  
SetWorkingDir %A_ScriptDir%  

en := DllCall("LoadKeyboardLayout","Str","00000409","Int",1)

#if winactive("ahk_class #32770") or winactive("ahk_exe Explorer.EXE")
f4::
    PostMessage 0x50,%en%,A
    send,{f4}
return

我做错了吗?

解决方法

DllCall可能不适用于所有程序。

尝试以下替代方法:

#NoEnv  
#Warn 
SendMode Input  
SetWorkingDir %A_ScriptDir%  


#if winactive("ahk_class #32770") or winactive("ahk_exe Explorer.EXE")
f4::
    SetInputLang(0x0409) ; english 
    send,{f4}
return

SetInputLang(Lang){
    WinExist("A")
    ControlGetFocus,CtrlInFocus
    PostMessage,0x50,% Lang,%CtrlInFocus%
}

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=18519#p233011

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。