Цитата FlatX007:
можно простой пример на 2 пункта трей меню ? »
|
Что оно даст? Вот урезанная версия без GUI:
Код:

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <ModernMenuRaw.au3> ; Only unknown constants are declared here
;
; *** Create the tray icon ***
$nTrayIcon1 = _TrayIconCreate("Tools", "shell32.dll", -13)
_TrayIconSetClick(-1, 16)
_TrayIconSetState() ; Show the tray icon
; *** Create the tray context menu ***
$nTrayMenu1 = _TrayCreateContextMenu() ; is the same like _TrayCreateContextMenu(-1) or _TrayCreateContextMenu($nTrayIcon1)
$nSideItem1 = _CreateSideMenu($nTrayMenu1)
_SetSideMenuText($nSideItem1, "My Tray Menu")
_SetSideMenuColor($nSideItem1, 0x00FFFF) ; yellow; default color - white
_SetSideMenuBkColor($nSideItem1, 0x802222) ; bottom start color - dark blue
_SetSideMenuBkGradColor($nSideItem1, 0x4477AA) ; top end color - orange
;_SetSideMenuImage($nSideItem3, "shell32.dll", 309, TRUE)
$TrayHelp = _TrayCreateItem("Help")
_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)
$MenuDrives = _TrayCreateMenu("Drives")
_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)
$TrayNotepad = _TrayCreateItem("Notepad")
$TrayCmd = _TrayCreateItem("Cmd")
$TrayCalc = _TrayCreateItem("Calc")
$TrayMSPaint = _TrayCreateItem("MSPaint")
_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)
$TrayExit = _TrayCreateItem("Exit")
_TrayItemSetIcon($TrayHelp, "shell32.dll", -24)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
_TrayItemSetIcon($MenuDrives, "shell32.dll", -9)
_TrayItemSetIcon($TrayNotepad, "Notepad.exe", 0)
_TrayItemSetIcon($TrayCmd, "Cmd.exe", 0)
_TrayItemSetIcon($TrayCalc, "Calc.exe", 0)
_TrayItemSetIcon($TrayMSPaint, "MSPaint.exe", 0)
_TrayItemSetIcon($TrayExit, "shell32.dll", -28)
_TrayCreateItem("Free Space:", $MenuDrives)
_TrayItemSetIcon(-1, "shell32.dll", -167)
GUICtrlSetState(-1, $GUI_DISABLE)
_TrayCreateItem("", $MenuDrives)
_TrayItemSetIcon(-1, "", 0)
$arDrives = DriveGetDrive("FIXED")
For $i = 1 To $arDrives[0]
_TrayCreateItem(StringUpper($arDrives[$i]) & " -> " & _
StringFormat("%.2f GB", DriveSpaceFree($arDrives[$i])), $MenuDrives)
_TrayItemSetIcon(-1, "shell32.dll", -9)
Next
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $TrayExit
ExitLoop
Case $TrayHelp
Msgbox(64, "About", "Menu color sample by Holger Kotsch")
Case $TrayNotepad
Run("Notepad.exe")
Case $TrayCmd
Run("Cmd.exe")
Case $TrayCalc
Run("Calc.exe")
Case $TrayMSPaint
Run("MSPaint.exe")
EndSwitch
WEnd
_TrayIconDelete($nTrayIcon1)