TrayRefresh()

; 从任务栏托盘中删除所有无效图标,应同时适用于 W7 和 W10
TrayRefresh() {
  DetectHiddenWindows % ("On", DHW:=A_DetectHiddenWindows)
  For _, title in ["ahk_class Shell_TrayWnd", "ahk_class NotifyIconOverflowWindow"] {
    For _, controlName in ["ToolbarWindow321","ToolbarWindow322","ToolbarWindow323","ToolbarWindow324"] {
      For _, iconSize in [24,32] { ; allIconSizes
        ControlGetPos, xTray, yTray, wdTray, htTray, %controlName%, %title%
        y := htTray - 10
        While (y > 0) {
          x := wdTray - iconSize/2
          While (x > 0) {
            point := (y << 16) + x
            PostMessage, 0x200, 0, %point%, %controlName%, %title%  ; WM_MOUSEMOVE := 0x200
            x -= iconSize/2
          }
          y -= iconSize/2
        }
      }
    }
  }
  DetectHiddenWindows %DHW%
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。