Detect which Taskbar button was clicked (identify target window)

拥有回忆 提交于 2019-12-05 19:40:17

That's a though one I have to admit. I can't offer you a best practice solution, but here is a little work around, maybe that enough for your purposes:

CoordMode, Mouse, Screen
~LButton:: 
    If (A_TimeSincePriorHotkey<400) and (A_PriorHotkey="~LButton") {
        WinGetPos, taskBarX, taskBarY, taskBarW, taskBarH, ahk_class Shell_TrayWnd
        MouseGetPos, mouseX, mouseY
        If (mouseX >= taskBarX && mouseY >= taskBarY && mouseX <= taskBarX+taskBarW && mouseY <= taskBarY+taskBarH)
            OnDoubleClickTaskbar()
    }
Return

OnDoubleClickTaskbar() {
    ;WinWaitNotActive, ahk_class Shell_TrayWnd
    Sleep, 200
    WinMaximize, A
}

Tested on Windows 8.1.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!