#include <GUIConstantsEx.au3>
Opt("TrayMenuMode",1)
TraySetState()
TraySetClick(8)
$hForm = GUICreate("", 300, 200)
$TrayMsg = TrayCreateItem("Message")
$TrayExit = TrayCreateItem("Exit")
GUISetState()
While 1
Switch TrayGetMsg()
Case $TrayExit
Exit
Case $TrayMsg
MsgBox(0, "Example", "Tray Item")
EndSwitch
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd