#include <GuiMenu.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Global $hMainMenu,$hSysMenu,$hother
Global Enum $hSys =0x1000,$hExit
$MainGUI = GUICreate("快捷工具条",400, 300, -1, 0)
$hSysMenu = _GUICtrlMenu_CreateMenu();这里建立第一菜单的内容, 包括二项
_GUICtrlMenu_InsertMenuItem($hSysMenu, 0, "系统设置", $hSys)
_GUICtrlMenu_InsertMenuItem($hSysMenu, 1, "", 0)
_GUICtrlMenu_InsertMenuItem($hSysMenu, 2, "退出", $hExit)
$hother = _GUICtrlMenu_CreateMenu();这里建立第二菜单,菜单下无内容
$hMainMenu = _GUICtrlMenu_CreateMenu();这里是二个菜单联系起来
_GUICtrlMenu_InsertMenuItem ($hMainMenu, 0, "第一菜单", 0, $hSysMenu)
_GUICtrlMenu_InsertMenuItem ($hMainMenu, 1, "第二菜单", 0, $hother)
_GUICtrlMenu_SetMenu($MainGUI, $hMainMenu);这里是创建刚才联系好的菜单
GUISwitch($MainGUI)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND");我是看了帮助,找到菜单要注册消息事件,MY_WM_COMMAND()处理菜单事件
GUISetState(@SW_SHOW)
;<=====END
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func MY_WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam);这里就是处理菜单事件
Switch $iwParam
Case $hExit
Exit
EndSwitch
EndFunc ;==>WM_COMMAND
仔细帮你调试了一下,中文菜单要完整显示必须要编译好才能完整 |