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. call menu item from program

call menu item from program

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 4 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.
  • V Offline
    V Offline
    vancouver777
    wrote on last edited by
    #1

    I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin

    T K 2 Replies Last reply
    0
    • V vancouver777

      I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin

      T Offline
      T Offline
      Terry ONolley
      wrote on last edited by
      #2

      You don't need to call the menu from a button. If you want more than 1 GUI object to be handled by the same code, then you should just edit the message maps to point to the same function.



      1 Reply Last reply
      0
      • V vancouver777

        I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin

        K Offline
        K Offline
        KaRl
        wrote on last edited by
        #3

        If your dialog box is modal, it could be dangerous to activate a command of the application. Anyway, here's the syntax: CMainFrame *pFrame = AfxGetApp()->m_pMainWnd; pFrame->SendMessage(WM_COMMAND, ID_MYMENU); Beware that with SendMessage, the call won't return before the execution of the command.


        Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

        S 1 Reply Last reply
        0
        • K KaRl

          If your dialog box is modal, it could be dangerous to activate a command of the application. Anyway, here's the syntax: CMainFrame *pFrame = AfxGetApp()->m_pMainWnd; pFrame->SendMessage(WM_COMMAND, ID_MYMENU); Beware that with SendMessage, the call won't return before the execution of the command.


          Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

          S Offline
          S Offline
          sdfdsfa
          wrote on last edited by
          #4

          Thank you very much. in this way, I can save a lot of time. however, I will be carefull with those point you mensioned. Thanks, again. Shin:laugh:

          K 1 Reply Last reply
          0
          • S sdfdsfa

            Thank you very much. in this way, I can save a lot of time. however, I will be carefull with those point you mensioned. Thanks, again. Shin:laugh:

            K Offline
            K Offline
            KaRl
            wrote on last edited by
            #5

            My pleasure :)


            Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

            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