Dynamic Sub menu C++

I have been stumped for about two days now!!!
i cant seem to add another sub menu to the "2" menu dynamically
does anyone know how todo it?
here is an example:
http://www.codeproject.com/KB/menus/DynMenu/DynMenu.gif

1
2
3
HMENU hSubMenu,hMenu;
AppendMenu(hSubMenu, MF_STRING|MF_POPUP, (UINT)hSubMenu, "2");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "1");


Last edited on
I had many problems too with thet but the solution is this:

1
2
3
4
5
6
7
8
HMENU hSubMenu,hMenu,hSubSubMenu;
hSubSubMenu=CreatePopupMenu();//this is the important step
hSubMenu=CreatePopupMenu();
hMenu=CreateMenu();
AppendMenu(hSubSubMenu, MF_STRING, (UINT)hSubSubMenu, "3");
AppendMenu(hSubMenu, MF_STRING|MF_POPUP, (UINT)hSubSubMenu, "2");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "1");
 SetMenu(hWnd,hMenu);

Last edited on
wow Bazzy i much appreciate the quick reply i cant thank you enough!
Topic archived. No new replies allowed.