Function Reference

TraySetIcon

Loads/Sets a specified tray icon.

TraySetIcon ( [filename [, iconID] )

 

Parameters

filename [optional] The filename of the icon to be display in the tray.
iconID [optional] Icon identifier if the file contain multiple icons.

 

Return Value

None.

 

Remarks

To reset the icon to the default, use the function with no parameters:
TraySetIcon().

Passing a positive number will reference the string equivalent icon name.
Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.

The filename parameter can be set to "blank", "info", "question", "stop" or "warning" to select some corresponding standard icon.

 

Related

TraySetPauseIcon, TraySetState

 

Example


#NoTrayIcon

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.

$exititem       = TrayCreateItem("Exit")

TraySetState()

$start = 0
While 1
    $msg = TrayGetMsg()
    If $msg = $exititem Then ExitLoop
    $diff = TimerDiff($start)
    If $diff > 1000 Then
        $num = -Random(0,100,1) ; negative to use ordinal numbering
        ToolTip("#icon=" & $num)
        TraySetIcon("Shell32.dll",$num)
        $start = TimerInit()
    EndIF
WEnd

Exit