找回密码
 加入
搜索
查看: 1405|回复: 2

如何把我这个源码做成带托盘图标?

[复制链接]
发表于 2009-6-21 23:40:54 | 显示全部楼层 |阅读模式
本帖最后由 cjmbbbbb 于 2009-6-22 00:17 编辑

如题,先出示我的源码,是一个循环检测再调用程序的:


#NoTrayIcon
While 1
        If WinExists("请输入资料") And ProcessExists("Fill.exe") = 0 Then
                RunWait(@ScriptDir&"\Fill.exe")
        EndIf
        Sleep(2000)
WEnd


我想实现的是,给它加一个托盘图标,易于操作,因为它没有图形界面......
请赐教啊!!!
 楼主| 发表于 2009-6-22 00:16:42 | 显示全部楼层
唉,真是不如信自己,解决了!


#NoTrayIcon
#Include <Constants.au3>

Opt("TrayMenuMode", 1)
Opt("trayOnEventMode", 1) 

$g_szVersion = "Filler"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)

$aboutitem = TrayCreateItem("关于")
TrayItemSetOnEvent($aboutitem, "TrayMsg") 
TrayCreateItem("")
$exititem = TrayCreateItem("退出")
TrayItemSetOnEvent($exititem, "TrayMsg") 

TraySetState()

While 1
        If WinExists("请输入资料") And ProcessExists("Fill.exe") = 0 Then
                RunWait(@ScriptDir&"\Fill.exe")
        EndIf
        Sleep(2000)
WEnd

Func TrayMsg()
        Switch @TRAY_ID
                Case $aboutitem
                        MsgBox(64, "关于程序", "我填!")
                Case $exititem
                        Exit
        EndSwitch
EndFunc
发表于 2009-10-24 20:05:20 | 显示全部楼层
如果是有界面的如何叫它显示!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-22 14:34 , Processed in 0.078097 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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