找回密码
 加入
搜索
查看: 2466|回复: 1

[AU3基础] 关于函数func退出的问题 已解决

[复制链接]
发表于 2010-4-28 16:28:28 | 显示全部楼层 |阅读模式
本帖最后由 lin0308 于 2010-4-29 16:35 编辑


func au()
Opt("TrayMenuMode",1)
$exit = TrayCreateItem("退出")
TraySetState()
While 1
$msg = TrayGetMsg()
        Select  
                Case $msg = $exit
                        Quit()
        EndSelect
Sleep(1)
以下是循环
..............
wend
endfunc

func quit()
这里面是一个输入密码的,密码正确才可以退出,错误返回 au()
endfunc

问题就在密码错误时返回au()时,发现托盘里有2个退出。
发表于 2010-4-29 09:57:16 | 显示全部楼层
#NoTrayIcon

Opt("TrayMenuMode",1)        ; 默认托盘菜单项目(脚本已暂停/退出脚本) (Script Paused/Exit) 将不显示.

$prefsitem        = TrayCreateItem("参数")
TrayCreateItem("")
$aboutitem        = TrayCreateItem("关于")
TrayCreateItem("")
$exititem        = TrayCreateItem("退出")

TraySetState()

While 1
        $msg = TrayGetMsg()
        Select
                Case $msg = 0
                        ContinueLoop
                Case $msg = $prefsitem
                        Msgbox(64, "参数:", "系统版本:" & @OSVersion)
                Case $msg = $aboutitem
                        Msgbox(64, "关于:", "AutoIt3-托盘-例子.")
                Case $msg = $exititem
                        quit();ExitLoop
        EndSelect
WEnd

;Exit
Func quit()
        $passwd = InputBox("安全性检查", "输入你的密码.", "", "*")
        If $passwd="abcde" Then 
                MsgBox(0,0,"密码输入正确")
                Exit
        EndIf
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-14 00:19 , Processed in 0.085986 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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