找回密码
 加入
搜索
查看: 4153|回复: 4

[AU3基础] [已解决]托盘问题 托盘菜单 点了没反应 应该怎么写?感谢user3000的大力帮助!

  [复制链接]
发表于 2014-12-16 10:36:46 | 显示全部楼层 |阅读模式
本帖最后由 mshuking 于 2014-12-17 14:33 编辑

[求助]托盘问题 托盘菜单 点了没反应 应该怎么写?
  最小化到 托盘 不显示在任务栏 怎么写?
最小化后 点 显示窗口 又如何写?
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayMenuMode",3)
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("测试", 313, 241, 349, 249)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("确定(&O)", 70, 203, 75, 25)
$Button2 = GUICtrlCreateButton("取消(&C)", 149, 204, 75, 25)
$Button3 = GUICtrlCreateButton("帮助(&H)", 229, 204, 75, 25)
$Start = TrayCreateItem("显示窗口(&A)")
TrayItemSetOnEvent($Start,"TrayMsg")
TrayCreateItem("")
$About = TrayCreateItem("关于(&H)")
TrayItemSetOnEvent($About,"TrayMsg")
TrayCreateItem("")
$Quit = TrayCreateItem("退出(&Q)")
TrayItemSetOnEvent($Quit,"TrayMsg")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE,$Button2,$Quit
                        Exit
        Case $About
                        MsgBox(48, '关于', '程序开发中。。。。')
                Case $Start
                        MsgBox(48, '这个怎么写', '显示窗口怎么写')
        EndSwitch
WEnd
正解   感谢user3000的大力帮助!
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayMenuMode", 3)
#region ### START Koda GUI section ### Form=
$Form2 = GUICreate("测试", 313, 241, 349, 249)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("确定(&O)", 70, 203, 75, 25)
$Button2 = GUICtrlCreateButton("取消(&C)", 149, 204, 75, 25)
$Button3 = GUICtrlCreateButton("帮助(&H)", 229, 204, 75, 25)
$Start = TrayCreateItem("显示窗口(&A)")
;TrayItemSetOnEvent($Start,"TrayMsg")
TrayCreateItem("")
$About = TrayCreateItem("关于(&H)")
;TrayItemSetOnEvent($About,"TrayMsg")
TrayCreateItem("")
$Quit = TrayCreateItem("退出(&Q)")
;TrayItemSetOnEvent($Quit,"TrayMsg")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $GUI_EVENT_MINIMIZE
                        GUISetState(@SW_HIDE, $Form2)
        EndSwitch
        $nMsg2 = TrayGetMsg()
        Switch $nMsg2
                Case $About
                        MsgBox(48, '关于', '程序开发中。。。。')
                Case $Start
                        GUISetState(@SW_SHOW, $Form2)
                        GUISetState(@SW_RESTORE, $Form2)
                        WinActivate($Form2)
                Case $Quit
                        Exit
        EndSwitch
WEnd
发表于 2014-12-16 19:14:16 | 显示全部楼层
回复 1# mshuking
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayMenuMode", 3)
#region ### START Koda GUI section ### Form=
$Form2 = GUICreate("测试", 313, 241, 349, 249)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("确定(&O)", 70, 203, 75, 25)
$Button2 = GUICtrlCreateButton("取消(&C)", 149, 204, 75, 25)
$Button3 = GUICtrlCreateButton("帮助(&H)", 229, 204, 75, 25)
$Start = TrayCreateItem("显示窗口(&A)")
;TrayItemSetOnEvent($Start,"TrayMsg")
TrayCreateItem("")
$About = TrayCreateItem("关于(&H)")
;TrayItemSetOnEvent($About,"TrayMsg")
TrayCreateItem("")
$Quit = TrayCreateItem("退出(&Q)")
;TrayItemSetOnEvent($Quit,"TrayMsg")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $GUI_EVENT_MINIMIZE
                        GUISetState(@SW_HIDE, $Form2)
        EndSwitch
        $nMsg2 = TrayGetMsg()
        Switch $nMsg2
                Case $About
                        MsgBox(48, '关于', '程序开发中。。。。')
                Case $Start
                        GUISetState(@SW_SHOW, $Form2)
                        GUISetState(@SW_RESTORE, $Form2)
                        WinActivate($Form2)
                Case $Quit
                        Exit
        EndSwitch
WEnd
 楼主| 发表于 2014-12-17 14:33:03 | 显示全部楼层
回复 2# user3000


    非常感谢。。。。。。。
发表于 2014-12-17 14:46:30 | 显示全部楼层
感谢,感谢,学习,需诶西,非常感谢
 楼主| 发表于 2015-1-1 12:02:22 | 显示全部楼层
免费学习中。…。…。……
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 12:24 , Processed in 0.076835 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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