找回密码
 加入
搜索
查看: 2225|回复: 3

[GUI管理] TrayItemSetOnEvent 能传递函数的参数吗?

  [复制链接]
发表于 2011-7-6 00:04:12 | 显示全部楼层 |阅读模式
TrayItemSetOnEvent 能传递函数的参数吗?
找了论坛,没发现有同学讨论过这个问题,
请问能实现吗?谢谢各位老师
发表于 2011-7-6 01:52:42 | 显示全部楼层
用全局变量吧
发表于 2011-7-6 11:21:28 | 显示全部楼层
本帖最后由 forestchi 于 2011-7-6 11:22 编辑
#NoTrayIcon

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)        ; Default tray menu items (Script Paused/Exit) will not be shown.
Global $nMsg  ;全局变量
TraySetClick(16)        ; Only secondary mouse button will show the tray menu.

$infoitem = TrayCreateItem("Info")
$nMsg="新值"
TrayItemSetOnEvent(-1,"ShowInfo")

TrayCreateItem("")

$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")

TraySetState()

While 1
        Sleep(10)        ; Idle loop
WEnd

Exit


; Functions
Func ShowInfo()
         ;Msgbox(0,"Info","Tray OnEvent Demo")
         MsgBox(0,"",$nMsg)
EndFunc


Func ExitScript()
        Exit
EndFunc
发表于 2011-7-6 13:41:43 | 显示全部楼层
au3好些函数不能传递参数的设计非常不好!
用全局变量使得可移植性变得很差
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-6 17:58 , Processed in 0.074126 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表