# Function Reference

TrayCreateMenu

Creates a menu control for the tray menu.

TrayCreateMenu ( "sub/menutext" [, menuID [, menuentry]] )

Parameters

sub/menutext | The sub/menu text.
menuID | [optional] If defined, allows you to create a submenu in the referenced menu. If equal -1 it refers to first level menu.
menuentry | [optional] Allows you to define the entry number to be created. The entries are numbered starting at 0.

Return Value

Success: | Returns the identifier (controlID) of the new tray menu.
Failure: | Returns 0.

Remarks

None.

Related

TrayItemSetState, TrayItemSetText

Example

#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
$settingsitem = TrayCreateMenu("Settings")
$displayitem = TrayCreateItem("Display", $settingsitem)
$printeritem = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $aboutitem
Msgbox(64,"About:","AutoIt3-Tray-sample")
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
Exit