I want to create popup menu. There will be a variable number of items in the popup menu (dont know how many). If an item is clicked, some action might be performed (I'll work that out), but a sub-popup menu might need to be produced. Can anyone get me started ?
Adding new menu's to the parent is easy enough.... all you do is make the menu items a control array (by naming them all the same thing, but changing the index to the next number up). Then, just like any object in a control array, load the element, and set it's properties. Once you get into sub-menu's (menu's with child menus [with the cute little arrow pointing right]) you are going to have a much more difficult time. If you are talking about adding items to a pre-existing sub-menu, cool, no problem, just treat it like you would another control array. The hard-part, is when you want to start adding your own sub-menu's to the parent menu, with sub-menu items.
You'll need to use the API to mess with menu's any more complex than that. You can check here for a good reference of menu api's: http://www.mangovision.com/vbapi/ref/funcc.html#menus. And http://www.mangovision.com/vbapi/ref/g/getmenu.html gives you a little code (they all will) on how to work menu's in the API. And Yet Here is a nice one: http://www.mangovision.com/vbapi/ref/i/insertmenuitem.htm.
Anyway, Attached is a project that does the simple addition of menu item's by using a control array, but should you need more, the API is the best bet and the way to go.