Function Reference


TraySetState

Sets the state of the tray icon.

TraySetState ( [flag] )

Parameters

flag [optional] A combination of the following:
1 = Shows the tray icon (default)
2 = Destroys/Hides the tray icon
4 = Flashes the tray icon
8 = Stops tray icon flashing
16 = Resets the icon to the defaults (no flashing, default tip text)

Return Value

None.

Remarks

This function overrides the "TrayIconHide"-option and "#NoTrayIcon"-setting.
The normal and pause tray icon are NOT reset by this function!

Related

TrayItemSetState, TraySetIcon, TraySetPauseIcon

Example


#NoTrayIcon

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

Local $exititem = TrayCreateItem("Exit")

TraySetIcon("warning")
TraySetToolTip("SOS")

TraySetState() ; Show the tray icon

Local $toggle = 0

While 1
    Local $msg = TrayGetMsg()
    Select
        Case $msg = 0
            Sleep(1000)
            If $toggle = 0 Then
                TraySetState() ; Show the tray icon
                $toggle = 1
            Else
                TraySetState(2) ; Hide the tray icon
                $toggle = 0
            EndIf
        Case $msg = $exititem
            ExitLoop
    EndSelect

WEnd

Exit