Jump to content

_SysTray UDF


wraithdu
 Share

Recommended Posts

On 10/14/2018 at 7:20 PM, masvil said:

The following example should be "universal"  because it checks ALL existing/valid instances on both hidden and visible icons. So it should be working on all past and future Windows vers unless the class(es) name will change. Note: there are some programs using a no-standard instance, but with my method you can catch those icons as well.
 

#NoTrayIcon
#include <GuiToolBar.au3>

Local $VisibleIcons
Local $HiddenIcons
Local $Instance

; Find systray handle for "User Promoted Notification Area"
$Instance = 0
While 1
    $Instance = $Instance + 1
    Local $hSysTray_Handle = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:" & $Instance & "]")
    If @error Then ExitLoop

    If Not @Compiled Then ConsoleWrite("VISIBLE at Istance #" & $Instance & ":" & @CRLF)

    Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ; Get vidible systray icon count

    For $iSystray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        $text = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber)
        If Not @Compiled Then ConsoleWrite($text & @CRLF)
    Next
    If Not @Compiled Then ConsoleWrite(@CRLF)
WEnd

; Find systray handle for "Overflow Notification Area" i.e. hidden icons
$Instance = 0
While 1
    $Instance = $Instance + 1
    Local $hSysTray_Handle_Hidden = ControlGetHandle("[Class:NotifyIconOverflowWindow]", "", "[Class:ToolbarWindow32;Instance:" & $Instance & "]")
    If @error Then ExitLoop

    If Not @Compiled Then ConsoleWrite("HIDDEN at Istance #" & $Instance & ":" & @CRLF)

    $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle_Hidden) ; Get hidden systray icon count

    For $iSystray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        $text = _GUICtrlToolbar_GetButtonText($hSysTray_Handle_Hidden, $iSystray_ButtonNumber)
        If Not @Compiled Then ConsoleWrite($text & @CRLF)
    Next
WEnd

Exit

 

This code is great, just what I needed, thanks a lot!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...