TraySetIcon
设置指定的托盘图标.
TraySetIcon ( [filename [, iconID]] )
参数
filename
|
[可选] 图标的文件名.
|
iconID
|
[可选] 如果图标文件包含多个图标, 则指定使用的图标标识符.
|
返回值
None.
备注
重新设定为默认图标时, 使用不带参数的函数: TraySetIcon().
传递一个正数将引用图标的名称.
传递一个负数将引用基于 1 的图标索引. 某些 DLL 只能用负值提取图标.
文件名参数可以设置为: "blank"(空), "info"(信息), "question"(询问), "stop"(停止) 或 "warning"(警告), 并选择一些相应的标准图标.
函数示例
#NoTrayIcon
#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 $idExit = TrayCreateItem("Exit")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Local $fDiff = 0, $iIndex = 0
While 1
$fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit
If $fDiff > 1000 Then ; If the difference is greater than 1 second then change the tray menu icon.
$iIndex = -Random(0, 100, 1) ; Use a negative number for ordinal numbering.
TraySetToolTip("Currently using the icon shell32.dll, " & $iIndex & ".") ; Set the tray menu tooltip with information about the icon index.
TraySetIcon("shell32.dll", $iIndex) ; Set the tray menu icon using the shell32.dll and the random index number.
$hTimer = TimerInit() ; Reset the timer.
EndIf
Switch TrayGetMsg()
Case $idExit ; Exit the loop.
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令调用 exect
参见:
TraySetPauseIcon, TraySetState
exect=TraySetState(1)||TraySetIcon(@ScriptDir&'\TCIMG.dll',1)||Sleep(5000) ;; 在托盘中设置图标的示例
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|