[Menu1]
Submenu11=cmd11
Submenu12=cmd12
[Menu2]
Submenu21=cmd21
[Menu3]
Submeniu31=cmd31
Submeniu32=cmd32
Submeniu33=cmd33
[Menu4]
Submenu41=cmd41
Submenu42=cmd42
The problem is that I can not get the values. I have read a post (http://www.autoitscript.com/forum/index.php?showtopic=106850&view=findpost&p=753987) from PsaltyDS, but I'm stucked...
The code so far:
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $sIni = @ScriptDir & "\menu.ini" $hForm = GUICreate("Sample INI menu", 633, 452, 192, 124) $readmenu = IniReadSectionNames($sIni) ;read section names to array For $i = 1 To $readmenu[0] $mnu = GUICtrlCreateMenu($readmenu[$i]) ;create menu from section names $var = IniReadSection($sIni, $readmenu[$i]) For $j = 1 To UBound($var) - 1 $var[$j][0]=GUICtrlCreateMenuItem($var[$j][0], $mnu); create submenus GUICtrlSetOnEvent(-1, "_MenuItemHit") ;the values are in the $var[$j][1] Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _MenuItemHit() Local $ctrlMenu = @GUI_CtrlId Local $hMenu = @GUI_CtrlHandle Local $iIndex, $sText For $iIndex = 1 To UBound($var) - 1 If $var[$iIndex][0] = $ctrlMenu Then $sText = $var[$iIndex][1] ExitLoop EndIf If $sText = "" Then $sText = "<Not Found>" Next ConsoleWrite("_MenuItemHit(): ID = " & $ctrlMenu & "; Handle = " & $hMenu & "; Text = " & $sText & @LF) EndFunc Func _Close() Exit EndFunc
If I try with Menu4, for example, it triggers the cmd41 and cmd42, but not for the other submenus.
Please point me in the right direction. Thank you in advance!
Edited by taietel, 19 May 2010 - 08:28 PM.





