为什么我这段代码的托盘菜单点击没反应的?
下面这段代码右键菜单点击没反应,请高手修改一下!#include <Constants.au3>#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include<ie.au3>
#include <ButtonConstants.au3>
Opt("TrayIconHide", 1)
Opt("TrayMenuMode",1)
Opt("TrayOnEventMode",1)
$prefsitem= TrayCreateItem("参数")
TrayCreateItem("")
$aboutitem= TrayCreateItem("关于")
TrayCreateItem("")
$exititem = TrayCreateItem("退出")
$oIE = _IECreateEmbedded ()
$Form1 = GUICreate(" 百度",860,632, -1,-1 , 0x04000000 + 0x00CF0000)
$GUIActiveX = GUICtrlCreateObj($oIE, 2, 2, 880, 680)
GUICtrlSetResizing($GUIActiveX , 0x0001)
GUISetState(@SW_SHOW)
TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"tray")
_IENavigate ($oIE, "http://www.baidu.com")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE, $Form1)
Opt("TrayIconHide", 0)
Case $prefsitem
Msgbox(64, "参数:", "系统版本:" & @OSVersion)
Case $aboutitem
Msgbox(64, "关于:", "AutoIt3-托盘-例子.")
EndSwitch
WEnd
Func tray()
Opt("TrayIconHide", 1)
GUISetState(@SW_SHOW, $Form1)
WinActivate($Form1)
EndFunc 回复 1# xunyar
$msg = TrayGetMsg()
你获取的是GUI事件,当然没反应了 我知道那里是弄错了,但是换成了获取托盘ID事件也一样是不行的哦 利用TrayOnEvent模式参考以下连接,试试看吧,参考一下这里http://www.autoitx.com/forum.php?mod=viewthread&tid=174
页:
[1]