Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to show a menu?

How to show a menu?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestionlearning
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BoudewijnEctor
    wrote on last edited by
    #1

    Hi, I've created an mfc dialog-based app, and a menu-resource. But I'd like the menu to appear in the dialog (at the moment it isn't appearing). I know I have to call some kind of CWnd::*** function, but which? In other words: I have a menu resource, and I want to use it by displaying the menu in the GUI! This is the most simple kind of menu, but I can't show it :confused:

    R L 2 Replies Last reply
    0
    • B BoudewijnEctor

      Hi, I've created an mfc dialog-based app, and a menu-resource. But I'd like the menu to appear in the dialog (at the moment it isn't appearing). I know I have to call some kind of CWnd::*** function, but which? In other words: I have a menu resource, and I want to use it by displaying the menu in the GUI! This is the most simple kind of menu, but I can't show it :confused:

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      Put this code in you OnInitDiaog()

      CMenu menu;

      menu.LoadMenu(ID_OF_MENU);

      SetMenu(&Menu);

      menu.Detach(); // CDialog will clean up for us in its OnDestroy()
      DrawMenuBar(); // make sure the UI is upto date

      Roger Allen - Sonork 100.10016 Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...

      1 Reply Last reply
      0
      • B BoudewijnEctor

        Hi, I've created an mfc dialog-based app, and a menu-resource. But I'd like the menu to appear in the dialog (at the moment it isn't appearing). I know I have to call some kind of CWnd::*** function, but which? In other words: I have a menu resource, and I want to use it by displaying the menu in the GUI! This is the most simple kind of menu, but I can't show it :confused:

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Declare an object of CMenu in the CDialog derived class CMenu m_Menu; In the overridden OnInitDialog member function call - m_Menu.LoadMenu(

        ); //load menu. SetMenu(&m_Menu); // set menu for the dialog window. This should work. :-O

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups