hybrid
Function tray_icon_added_removed_notifications
Function tray_icon_added_removed_notifications
;/exe
int iconExisted=sub.TrayIconExists
int hh=SetWinEventHook(EVENT_OBJECT_CREATE EVENT_OBJECT_DESTROY 0 &sub.Hook_SetWinEventHook 0 0 WINEVENT_OUTOFCONTEXT)
opt waitmsg 1
wait -1
UnhookWinEvent hh
#sub Hook_SetWinEventHook v
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
;outw hwnd ;;debug
;out "%i %i %i" event idObject idChild
if(idObject!=-4 or !WinTest(hwnd "ToolbarWindow32")) ret
_s.getwintext(hwnd); if(_s!="User Promoted Notification Area") ret
Acc a1.FromEvent(hwnd idObject idChild)
;_s=a1.Name; out _s
int iconExists=sub.TrayIconExists(a1)
if(iconExists=iconExisted) ret
iconExisted=iconExists
OnScreenDisplay iif(iconExists "Icon added" "Icon removed") -1 0 0 0 0 0 4|8 "Safely Remove"
#sub TrayIconExists
function! [Acc&anyIcon]
Acc a1
if &anyIcon
,anyIcon.Navigate("parent" a1)
,a1.Find(a1.a "PUSHBUTTON" "Safely Remove Hardware and Eject Media" "class=ToolbarWindow32" 0x5)
else
,int w=win("" "Shell_TrayWnd")
,a1.Find(w "PUSHBUTTON" "Safely Remove Hardware and Eject Media" "class=ToolbarWindow32" 0x5)
ret !a1.NotFound
;BEGIN PROJECT
;END PROJECT