How to modify a menu into a menu Folder(contains submenus) ??

This is a discussion on How to modify a menu into a menu Folder(contains submenus) ?? within the Windows Programming forums, part of the Platform Specific Boards category; How to modify a menu into a menu Folder(contains submenus) ?? i wrote this : Code: HMENU tm = GetSubMenu( ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    88

    How to modify a menu into a menu Folder(contains submenus) ??

    How to modify a menu into a menu Folder(contains submenus) ??

    i wrote this :

    Code:
    	
    HMENU tm = GetSubMenu( m, 0 );
    
    MENUITEMINFO tINFO;
    GetMenuItemInfo( tm, 0, true, &tINFO );
    
    // alright , no error. the tINFO is Ok. do what is here ??
    
    SetMenuItemInfo( tm, 0, true, &tINFO );
    
    AppendMenu( GetSubMenu(tm,0) , MF_STRING, 0, "Hello !" );

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    you'll have to elaborate on what you want to happen.

    if you want to make a menu with submenus, do this:

    Code:
    HMENU hMenuBar; //the menu bar
    HMENU hMenuPopup; //A popup menu
    HMENU hNestMenu; //A popup within the popup
    
    hMenuBar=CreateMenu(); //Create the menu bar
    hMenuFile=CreatePopupMenu(); //Create popup
    hNestMenu=CreatePopupMenu(); //Create popup
    
    //Now just add one menu to another
    AppendMenu(hMenuBar,MF_POPUP|MF_STRING,(UINT)hMenuPopup,"&Menu 1");
        AppendMenu(hMenuPopup,MF_POPUP|MF_STRING,(UINT)hNestMenu,"&Menu 2");
            AppendMenu(hNestMenu,MF_STRING,ID_WHATEVER,"Item");
    i know people will tell me that AppendMenu has been superseeded by InsertMenuItem, but its much easier to use.

    Okay, the basic idea is, you need a menu bar as a base. then you add items to it, either single items or popup menus. if you're adding a menu, specify MF_POPUP as well as MF_STRING. you always need MF_STRING because every menu item has a string.

    that should be adequate, unless you're using resources. in that case, i'll never speak to you again .
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    ok , thx, i got it . i will try later...

    this may be wrong ,
    >>> hMenuFile=CreatePopupMenu(); //Create popup

  4. #4
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753
    use resources!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21