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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to call a menu by clicking a button from a dialog?

how to call a menu by clicking a button from a dialog?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
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.
  • Y Offline
    Y Offline
    yeefarn
    wrote on last edited by
    #1

    hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!

    T R 2 Replies Last reply
    0
    • Y yeefarn

      hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      I guess it's CMenu::TrackPopupMenu you're looking for, probably with TPM_RETURNCMD flag. Tomasz Sowinski -- http://www.shooltz.com

      no animal was harmed more than once during creation of this post

      1 Reply Last reply
      0
      • Y yeefarn

        hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!

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

        If you want the menu options to always be available. Do something like this in your OnInitDialog() CMenu menu; menu.LoadMenu(ID_OF_MENU); SetMenu(menu.m_hMenu); menu.Detach();// now owned by dialog DrawMenuBar(); The dialog will destroy the menu automatically when itselef is destroyed You then just need to write ON_COMMAND() handlers for each item. If you need to enable/disable items, handle the WM_INITMENUPOPUP message and process the individual items there. 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
        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