billym Posted January 10, 2008 Share Posted January 10, 2008 (edited) *** FOUND A BETTER SOLUTION USING XML - THX *** I have figured out how to create my systray menu from an ini file but do not know how to assign items and menus to other menus. Here is the format of my ini: ; TYPE = 1 is menu, 2 is item ; IDENT = unique number identified ; MENUID = -1 assigns to root menu otherwise assign to IDENT of menu you want placed in. [Toolz] TYPE=1 IDENT=1 MENUID=-1 [Testing] TYPE=MENU IDENT=2 MENUID=1 [Resources] TYPE=MENU IDENT=3 MENUID=-1 [Projects] TYPE=ITEM IDENT=4 MENUID=3 Here is the code that I was working on to do this: Func LoadMenu() If Not FileExists($inifile) Then MsgBox(4096,"Network Access", "Unable to access configuration file") Exit EndIf $var = IniReadSectionNames($inifile) If @error Then MsgBox(4096, "File Access Error", "Unable to access configuration file") Else For $i = 1 To 100 TrayItemDelete($i) Next For $i = 1 To $var[0] if IniRead($inifile, $var[$i], "TYPE", "ITEM") = "MENU" Then $mnuid = IniRead($inifile, $var[$i], "IDENT", "-1") $mnparent = IniRead($inifile, $var[$i], "MENUID", "-1") if Not $mnparent = "-1" Then $mnparent = $menuitems[$mnparent] $menuitems[$mnuid] = TrayCreateMenu($var[$i], $mnparent, -1) EndIf If @error Then MsgBox(4096, "File Access Error", "Unable to access configuration file") Else EndIf ;$tid = TrayCreateItem ($var[$i], -1 , -1,-1) ;TrayItemSetOnEvent(-1,"menuevent") Next EndIf $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"end") TraySetState() EndFunc Edited January 10, 2008 by billym Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now