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

有没有类似热键的【热菜单】?

[复制链接]
发表于 2008-5-26 23:59:43 | 显示全部楼层 |阅读模式
发现热键却是好用啊,呵呵。比如下面的程序,在任何时候按ESC都可以退出的。
由此,能否设计类似的托盘菜单,在任何时候都可以退出运行。
比如下面的代码,热键是可以做到的,那能否将托盘的菜单“EXIT”也能达到类似的功效呢(任何时候退出运行),如何做呢。
HotKeySet("{ESC}", "out")
#NoTrayIcon
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$prefsitem = TrayCreateItem("Preferences")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

TraySetState()
While 1
        $msg = TrayGetMsg()
        Select
                Case $msg = 0
                        ContinueLoop
                Case $msg = $prefsitem
                        MsgBox(64, "Preferences:", "OS:" & @OSVersion)
                Case $msg = $aboutitem
                        MsgBox(64, "About:", "AutoIt3-Tray-sample.")
                Case $msg = $exititem
                        ExitLoop
        EndSelect
        runing()
WEnd
Func runing()
        While 1
                Sleep(500)
        WEnd
EndFunc   ;==>runing
Func out()
        Exit
EndFunc   ;==>out


[ 本帖最后由 jiataifeng 于 2008-5-28 00:48 编辑 ]
发表于 2008-5-27 15:40:56 | 显示全部楼层

评分

参与人数 1金钱 +3 贡献 +2 收起 理由
jiataifeng + 3 + 2

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 06:06 , Processed in 0.074271 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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