Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About the System Tray
#5
Hook code would be this. But Windows gives incorrect idChild, always 1. Therefore we don't know what icon has been added.

Macro Macro1708
Code:
Copy      Help
out

int hh=SetWinEventHook(EVENT_OBJECT_CREATE EVENT_OBJECT_CREATE 0 &sub.Hook_SetWinEventHook 0 0 WINEVENT_OUTOFCONTEXT)
if(!hh) end F"{ERR_FAILED}. {_s.dllerror}"
opt waitmsg 1
wait -1
UnhookWinEvent hh


#sub Hook_SetWinEventHook
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime

;outw hwnd ;;debug
;out "%i %i" 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

Other option - find the icon as accessible object, and wait. To create code, use dialog "Find accessible object"; it's in the floating toolbar. But it uses CPU while waiting; on my PC 4.5%.

Macro Macro1710
Code:
Copy      Help
int w=wait(-1 WV win("" "Shell_TrayWnd"))
Acc a.Find(w "PUSHBUTTON" "Safely Remove Hardware and Eject Media" "class=ToolbarWindow32[]id=1504" 0x1005 -1)
out a.Name


Messages In This Thread
About the System Tray - by RoryT84 - 06-10-2020, 05:16 PM
RE: About the System Tray - by InterestedNewbie - 06-18-2020, 01:19 PM
RE: About the System Tray - by Gintaras - 06-18-2020, 05:50 PM
RE: About the System Tray - by RoryT84 - 06-20-2020, 09:09 PM
RE: About the System Tray - by Gintaras - 06-21-2020, 04:56 AM
RE: About the System Tray - by RoryT84 - 06-21-2020, 08:24 PM
RE: About the System Tray - by Kevin - 06-22-2020, 04:24 PM
RE: About the System Tray - by Gintaras - 06-22-2020, 04:51 PM
RE: About the System Tray - by RoryT84 - 06-23-2020, 12:05 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)