Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持 UWP #1

Open
tristone13th opened this issue Apr 3, 2022 · 3 comments
Open

不支持 UWP #1

tristone13th opened this issue Apr 3, 2022 · 3 comments

Comments

@tristone13th
Copy link

isEnglishMode(){
    hWnd := winGetID("A")
    result := SendMessage(
        0x283, ; Message : WM_IME_CONTROL
        0x001, ; wParam : IMC_GETCONVERSIONMODE
        0,     ; lParam : (NoArgs)
        ,      ; Control : (Window)
               ; Retrieves the default window handle to the IME class.
        "ahk_id " DllCall("imm32\ImmGetDefaultIMEWnd", "Uint", hWnd, "Uint")
    )
    ; 返回值是0表示是英文模式,其他值表明是中文模式
    return result == 0
}

这段代码可以检测到普通的窗口,但是没有办法检测到 UMP 窗口,比如 Microsoft TODO。

@yfzhao20
Copy link
Owner

yfzhao20 commented Apr 4, 2022

试着在前面加上下面这一段代码

DetectHiddenWindows True

如果加上还没有用,那么我也暂时解决不了🤣,我不怎么熟悉UWP

@tristone13th
Copy link
Author

好的,谢谢,我的已经加上了,还是不行。

@CarlHey
Copy link

CarlHey commented Feb 14, 2023

这里的问题出在很多 UWP 应用使用了 ApplicationFrameHost,如果用 Window Spy 会发现不同的应用检测到的都是这个,于是代码里的 WinGetID("A") 就失效了。解决办法如下:

首先增加函数:

WinGetActiveID() {
    name := WinGetProcessName("A")
    if (name = "ApplicationFrameHost.exe") {
        return ControlGetHwnd("Windows.UI.Core.CoreWindow1", "A")
    } else {
        return WinGetID("A")
    }
}

然后把代码里的 WinGetID("A") 替换成上面定义的 WinGetActiveID() 就可以了。

希望有帮助 :)

参考资料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants