I wanna create some menus totally dynamic but don't understand what the hell it says in the win32 API ref, i wanna know how do i define something as a submenu? how do i place several menus beside eachother on the menu bar? anyone got code on totally dynamic menu creation? no resources and that kind of stuff? i wanna make a simple application that works as follows: it creates a hidden window that spans the whole screen width but is just the height of a the menubar... when i move the mouse to the top edge of the screen the window will become visible, activated and frontmost so i can click on one of the menus in it and launch a program etc etc. The menus is gonna be created dynamically at startup from a textfile. it's just i don't understand what the hell the API ref says. All i can find is explanations of a single menu with no subitems. anyone got some code to show me? i can only find resource menus in iczelions tutorials.
Posted on 2000-11-07 12:51:00 by Zynaps
You have, first, to create your PopUp(s) and only after it is done create the menu (backward > if nested, begin full down > up tree). Exemple of a menu with only one popup as first item: - the PopUp has 2 items - the whole menu has 1 PopUp + 2 Items ("ItemXX.." are IDs that you define) ; The Popup creation first: api 'USER32.CreatePopupMenu' | mov D§Popup1Handle eax ; The Popup filling: api 'USER32.AppendMenuA' D§Popup1Handle &MF_STRING ItemA_ID ItemA_String api 'USER32.AppendMenuA' D§Popup1Handle &MF_STRING ItemB_ID ItemB_String ; Now creating the menu: api 'USER32.CreateMenu' | mov D§MenuHandle eax ; Filling the Menu. PopUp in pos 1 (base is 0 in fact...): api 'USER32.AppendMenuA' D§MenuHandle &MF_POPUP D§Popup1Handle Item1_String ; adding finally Item 2 and 3: api 'USER32.AppendMenuA' D§MenuHandle &MF_STRING Item2_ID Item2_String api 'USER32.AppendMenuA' D§MenuHandle &MF_STRING Item3_ID Item3_String _______________________ Another simple way to do this is "LoadMenuIndirect" function where the only difficulty, bad singaled in Win32.hlp is the need of alignement for some data... another story... hope you will translate easily from SpAsm to MASM: D§Something >>> Dword Ptr Something >>> ADDR Something Bye. betov. (And "what the hell", have fun...)
Posted on 2000-11-07 15:12:00 by Betov