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

托盘菜单项是否勾选判断

[复制链接]
发表于 2009-12-12 01:04:44 | 显示全部楼层 |阅读模式
#Include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)

$Hy = IniRead(@ScriptDir& "" &"Config.ini", "设置", "自动激活", "")


$checkeditem        = TrayCreateItem("自动激活")
If $Hy = "是" Then
TrayItemSetState($checkeditem,$TRAY_CHECKED)
ElseIf $Hy = "否" Then
TrayItemSetState($checkeditem,$TRAY_UNCHECKED)

EndIf

TrayCreateItem("")
$exititem                = TrayCreateItem("退出")

TraySetState()

While 1
        $msg = TrayGetMsg()
        Select
                Case $msg = 0
                        ContinueLoop
                Case $msg = $checkeditem

    If TrayItemGetState($checkeditem) = 65 Then
            IniWrite(@ScriptDir& "" &"Config.ini", "设置", "自动激活", "是")
        
    ElseIf TrayItemGetState($checkeditem) = 68 Then
        IniWrite(@ScriptDir& "" &"Config.ini", "设置", "自动激活", "否")
        Dim $i
        $i = $i + 1

        If $i = 1 Then

            If $Hy = "否" Then
                TrayItemSetState($checkeditem,$TRAY_CHECKED)
                    IniWrite(@ScriptDir& "" &"Config.ini", "设置", "自动激活", "是")        
            EndIf

        $i = 1
        EndIf

    EndIf

                Case $msg = $exititem
                        ExitLoop
        EndSelect
WEnd

Exit
我自己写了一个,不知道这样对不对呢?还有更好的方法吗?
 楼主| 发表于 2009-12-12 21:35:20 | 显示全部楼层
周末无人。。。。
 楼主| 发表于 2009-12-12 21:42:43 | 显示全部楼层
这样单独设置没有问题,但应用到写好的程序中就出错了!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 15:37 , Processed in 0.078038 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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