Sets the state of a tray menu/item control.
TrayItemSetState ( controlID, state )
| controlID | The control identifier (controlID) as returned by a TrayCreateItem or TrayCreateMenu function. |
| state | See the State table below. |
| Success: | Returns 1. |
| Failure: | Returns 0. |
| State | Value | Comments |
| No Change | 0 | |
| $TRAY_CHECKED | 1 | Menuitem will be checked |
| $TRAY_UNCHECKED | 4 | Menuitem will be unchecked |
| $TRAY_ENABLE | 64 | Menuitem will be enabled |
| $TRAY_DISABLE | 128 | Menuitem will be greyed out |
| $TRAY_FOCUS | 256 | Menuitem will be selected |
| $TRAY_DEFAULT | 512 | Menuitem will be set as default menuitem |
#include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Local $chkitem = TrayCreateItem("Check it")
TrayCreateItem("")
Local $checkeditem = TrayCreateItem("Checked")
TrayCreateItem("")
Local $exititem = TrayCreateItem("Exit")
TraySetState()
While 1
Local $msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $chkitem
TrayItemSetState($checkeditem, $TRAY_CHECKED)
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
Exit