#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Local $hGUI = GUICreate('', 400, 400)
Local $idSetMenu = GUICtrlCreateMenu("设置[&S]", -1, 1)
Local $idTopItem = GUICtrlCreateMenuItem("窗口置顶", $idSetMenu)
GUICtrlSetState(-1, $GUI_CHECKED)
Local $idRepeatItem = GUICtrlCreateMenuItem("结果去重", $idSetMenu)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateMenuItem("", $idSetMenu, 2)
Local $idFunctionItem = GUICtrlCreateMenuItem("功能设置", $idSetMenu)
GUISetState(@SW_SHOW)
WinSetOnTop($hGUI, "", 1)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case -3
Exit
Case $idTopItem
If BitAND(GUICtrlRead($idTopItem), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($idTopItem, $GUI_UNCHECKED)
WinSetOnTop($hGUI, "", 0)
Else
GUICtrlSetState($idTopItem, $GUI_CHECKED)
WinSetOnTop($hGUI, "", 1)
EndIf
Case $idRepeatItem
If BitAND(GUICtrlRead($idRepeatItem), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($idRepeatItem, $GUI_UNCHECKED)
Else
GUICtrlSetState($idRepeatItem, $GUI_CHECKED)
EndIf
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Switch $lParam
Case GUICtrlGetHandle($idRepeatItem)
ToolTip(GUICtrlGetHandle($idRepeatItem), 600, 600)
MsgBox(0,0,"???????", '', $hGUI)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
各位大神,我的目的是当点击菜单项目$idRepeatItem的时候,执行Msgbox(),可是现在不管点击哪个菜单项目,不知道为什么都会弹出Msgbox()呢?
|