数据这么多有点难,要想别的办法
Func _CreateMenu()
Local $hMenu = _GUICtrlMenu_CreatePopup()
Local $hMenuC, $hMenuB
For $ii = 1 To 3
$hMenuB = _GUICtrlMenu_CreateMenu()
For $jj = 1 To 3
$hMenuC = _GUICtrlMenu_CreateMenu()
;For $ji = 1 To 4
_GUICtrlMenu_AddMenuItem($hMenuC, '子菜单A ' , $e_idOpen)
_GUICtrlMenu_AddMenuItem($hMenuC, '保存子菜单 ' , $e_idOpen1)
_GUICtrlMenu_AddMenuItem($hMenuC, '信息子菜单 ' , $e_idOpen2)
_GUICtrlMenu_AddMenuItem($hMenuC, '打开子菜单 ' , $e_idOpen3)
;Next
_GUICtrlMenu_AddMenuItem($hMenuB, '子菜单 ' & $jj, 0, $hMenuC)
Next
_GUICtrlMenu_AddMenuItem($hMenu, '主菜单 ' & $ii, 0, $hMenuB)
Next
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Local $tPoint = DllStructCreate('int X;int Y')
DllStructSetData($tPoint, 'X', 10)
DllStructSetData($tPoint, 'Y', 10 + 15)
DllCall('user32.dll', 'bool', 'ClientToScreen', 'hwnd', $hGUI, 'struct*', $tPoint)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, DllStructGetData($tPoint, 1), DllStructGetData($tPoint, 2))
_GUICtrlMenu_DestroyMenu($hMenu)
EndFunc ;==>_CreateMenu
; 处理 WM_COMMAND 消息
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $lParam
Local $sRead, $sRead1, $sRead2, $sRead3
Switch $wParam
Case $e_idOpen;[1]
$sRead = "菜单1/菜单2/菜单3/菜单4";你点击了 [打开]
Case $e_idOpen1;[2]
$sRead3 = " 保存"
Case $e_idOpen2;[3]
$sRead2 = "信息"
Case $e_idOpen3;[4]
$sRead1 = "打开"
EndSwitch
GUICtrlSetData($showLabel, $sRead1 & $sRead2 & $sRead3 & $sRead)
EndFunc ;==>WM_COMMAND
|