TraySetState
设置托盘图标状态.
TraySetState ( [flag = 1] )
参数
flag
|
[可选] 由以下值组合:
$TRAY_ICONSTATE_SHOW (1) = 显示托盘图标 (默认)
$TRAY_ICONSTATE_HIDE (2) = 销毁/隐藏托盘图标
$TRAY_ICONSTATE_FLASH (4) = 闪烁托盘图标
$TRAY_ICONSTATE_STOPFLASH (8) = 停止托盘图标闪烁
$TRAY_ICONSTATE_RESET (16) = 重置图标为默认值 (不闪烁, 默认提示文本)
常量定义在 TrayConstants.au3
|
返回值
None.
备注
本函数忽略 Opt("TrayIconHide") 选项与 #NoTrayIcon 选项.
"正常/脚本暂停" 图标不能使用这个函数来重置!
函数示例
#NoTrayIcon
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant.
Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
Example()
Func Example()
Local $idFlash = TrayCreateItem("Flash Icon")
TrayCreateItem("") ; Create a separator line.
Local $idAbout = TrayCreateItem("About")
TrayCreateItem("") ; Create a separator line.
Local $idExit = TrayCreateItem("Exit")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
While 1
Switch TrayGetMsg()
Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable.
MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _
"Version: " & @AutoItVersion & @CRLF & _
"Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)) ; Find the folder of a full path.
Case $idFlash
; Start flashing the tray icon.
TraySetState($TRAY_ICONSTATE_FLASH)
Sleep(5000) ; Wait for 5 seconds.
; Stop flashing the tray icon.
TraySetState($TRAY_ICONSTATE_STOPFLASH)
Case $idExit ; Exit the loop.
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令调用 exect
参见:
TraySetIcon, TraySetPauseIcon
exect=TraySetState(1)||TraySetIcon(@ScriptDir&'\TCIMG.dll',1)||Sleep(5000) ;; 在托盘中设置图标的示例
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|