I can't seem to find any tutorials on how to do this, but I want to add a submenu onto menu items, so that when the mouse hovers over it, another menu comes out from that. How would I do it?
This is a discussion on How do you get a submenu to come out from a menu item? within the Windows Programming forums, part of the Platform Specific Boards category; I can't seem to find any tutorials on how to do this, but I want to add a submenu onto ...
I can't seem to find any tutorials on how to do this, but I want to add a submenu onto menu items, so that when the mouse hovers over it, another menu comes out from that. How would I do it?
I would search MSDN for submenus. They also have a mixed C#/C++ walkthrough which may or may not be helpful.
I use AppendMenu() to set up my menus, and then you just create another menu and set it as a child of another menu.
Code://Handles for menu MainMenu = CreateMenu(); SubMenu = CreatePopupMenu(); //File menu AppendMenu(MainMenu,MF_POPUP|MF_STRING,(UINT)SubMenu,"&File"); AppendMenu(SubMenu,MF_POPUP,FILE_RESET,"Reset"); AppendMenu(SubMenu,MF_SEPARATOR,NULL,NULL); AppendMenu(SubMenu,MF_POPUP,FILE_EXIT,"Exit"); SubMenu = CreatePopupMenu(); HMENU SubMenuTwo = CreatePopupMenu(); //create submenu AppendMenu(MainMenu,MF_POPUP,(UINT)SubMenu,"&View"); AppendMenu(SubMenu,MF_POPUP|MF_STRING,EXTENDED,"Extended View"); AppendMenu(SubMenu,MF_POPUP,(UINT)SubMenuTwo,"Reference"); AppendMenu(SubMenuTwo,MF_POPUP,REF_OPEN,"Open References"); //this is the submenu and the 'parent' is "Reference" SubMenu = CreatePopupMenu(); AppendMenu(MainMenu,MF_POPUP,(UINT)SubMenu,"&Options"); AppendMenu(SubMenu,MF_POPUP,OPTIONS_CH,"Options Choices"); SubMenu = CreatePopupMenu(); AppendMenu(MainMenu,MF_POPUP,(UINT)SubMenu,"&Help"); AppendMenu(SubMenu,MF_POPUP,ABOUT_ABOUT,"About"); AppendMenu(SubMenu,MF_POPUP,INFO,"Info"); //Make menu appear on screen SetMenu(hwnd,MainMenu);