# Function Reference

TraySetIcon

Loads/Sets a specified tray icon.

TraySetIcon ( [iconfile [, 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

Success: | Returns 1.
Failure: | Returns 0.

Remarks

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

Related

TraySetPauseIcon

Example

#Include <Constants.au3>
#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
TraySetIcon("Shell32.dll",Random(0,100,1))
$start = TimerInit()
EndIF
WEnd
Exit