Refresh System tray Icons Topic is solved
Re: Refresh System tray Icons
Noesis's script works for me ; I just had to change "ToolbarWindow322" to "ToolbarWindow323". I am using Win10 Pro v1903.
Re: Refresh System tray Icons
Building on what has been said in this thread, the following function works on Win 10 Pro (Version 21H2; OS build 19044.1766).
Code: Select all
; Source: https://www.autohotkey.com/boards/viewtopic.php?t=19832
Tray_Refresh()
{
WM_MOUSEMOVE := 0x200
HiddenWindows := A_DetectHiddenWindows
DetectHiddenWindows, On
TrayTitle := "AHK_class ShellToolbarWindow323_TrayWnd"
ControlNN := "ToolbarWindow323"
IcSz := 24
Loop, 2
{
ControlGetPos, xTray,yTray,wdTray,htTray, %ControlNN%, %TrayTitle%
y := htTray - 10
While (y > 0)
{
x := wdTray - IcSz/2
While (x > 0)
{
point := (y << 16) + x
PostMessage, %WM_MOUSEMOVE%, 0, %point%, %ControlNN%, %TrayTitle%
x -= IcSz/2
}
y -= IcSz/2
}
TrayTitle := "AHK_class NotifyIconOverflowWindow"
ControlNN := "ToolbarWindow321"
IcSz := 32
}
DetectHiddenWindows, %HiddenWindows%
Return
}
- A Keymaker
- Posts: 455
- Joined: 31 May 2022, 13:46
- Location: Donjon du Château de Mérovingien
Re: Refresh System tray Icons
For me, in 2023Q1 still being stuck on Windows 10 Enterprise 20H2 x64, this works
masato wrote: ↑26 Jun 2017, 21:04[...]But I add at the end of itCode: Select all
Tray_Refresh() Tray_Refresh() { /* Remove any dead icon from the tray menu * Should work both for W7 & W10 */ WM_MOUSEMOVE := 0x200 detectHiddenWin := A_DetectHiddenWindows DetectHiddenWindows, On allTitles := ["ahk_class Shell_TrayWnd" , "ahk_class NotifyIconOverflowWindow"] allControls := ["ToolbarWindow321" ,"ToolbarWindow322" ,"ToolbarWindow323" ,"ToolbarWindow324"] allIconSizes := [24,32] for id, title in allTitles { for id, controlName in allControls { for id, iconSize in 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,% WM_MOUSEMOVE, 0,% point,% controlName,% title x -= iconSize/2 } y -= iconSize/2 } } } } DetectHiddenWindows, %detectHiddenWin% }
so that it will be executed every 10 seconds in the backgroundCode: Select all
SetTimer, Tray_Refresh, 9999 While true Sleep, 999
And I have a question about the DetectHiddenWindows: if I have a hidden window that did not crash thus not have a ghost icon in Tray [because it was never visible in Tray], will this hidden program be somehow affected?
And is it safe to run this code in a loop?
Last edited by A Keymaker on 04 Jul 2023, 05:46, edited 1 time in total.
Re: Refresh System tray Icons
Has anyone converted a working script to AutoHotkey V2?
- A Keymaker
- Posts: 455
- Joined: 31 May 2022, 13:46
- Location: Donjon du Château de Mérovingien
Re: Refresh System tray Icons
Well it has stoppedA Keymaker wrote: ↑16 Feb 2023, 16:09For me, in 2023Q1 still being stuck on Windows 10 Enterprise 20H2 x64, this works
[...]
But what works is this one:
viewtopic.php?f=76&t=113015&p=503514#p503514
-
- Posts: 7
- Joined: 30 Nov 2023, 01:32
Re: Refresh System tray Icons
works in win11-64, tytyllinfeng wrote: ↑22 Jun 2022, 12:52Building on what has been said in this thread, the following function works on Win 10 Pro (Version 21H2; OS build 19044.1766).
Code: Select all
; Source: https://www.autohotkey.com/boards/viewtopic.php?t=19832 Tray_Refresh() { WM_MOUSEMOVE := 0x200 HiddenWindows := A_DetectHiddenWindows DetectHiddenWindows, On TrayTitle := "AHK_class ShellToolbarWindow323_TrayWnd" ControlNN := "ToolbarWindow323" IcSz := 24 Loop, 2 { ControlGetPos, xTray,yTray,wdTray,htTray, %ControlNN%, %TrayTitle% y := htTray - 10 While (y > 0) { x := wdTray - IcSz/2 While (x > 0) { point := (y << 16) + x PostMessage, %WM_MOUSEMOVE%, 0, %point%, %ControlNN%, %TrayTitle% x -= IcSz/2 } y -= IcSz/2 } TrayTitle := "AHK_class NotifyIconOverflowWindow" ControlNN := "ToolbarWindow321" IcSz := 32 } DetectHiddenWindows, %HiddenWindows% Return }
Who is online
Users browsing this forum: CodeKiller, teadrinker and 204 guests