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 change text of the menu item?

How to change text of the menu item?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutorial
8 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.
  • M Offline
    M Offline
    manish patel
    wrote on last edited by
    #1

    Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,

    Manish Patel. B.E. - Information Technology.

    N M 2 Replies Last reply
    0
    • M manish patel

      Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,

      Manish Patel. B.E. - Information Technology.

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      Have a look at CMenu::ModifyMenu

      - NS - [ODBaseBtn]

      M 1 Reply Last reply
      0
      • N Nishad S

        Have a look at CMenu::ModifyMenu

        - NS - [ODBaseBtn]

        M Offline
        M Offline
        manish patel
        wrote on last edited by
        #3

        Thanks for quick reply, I have seen that function. It runs fine but i am not able to see any change to the text of the menu item. Is there any rule to use this function, If so then please let me know. Let me know if you have any other solution. Thanks and Regards,

        Manish Patel. B.E. - Information Technology.

        N 1 Reply Last reply
        0
        • M manish patel

          Thanks for quick reply, I have seen that function. It runs fine but i am not able to see any change to the text of the menu item. Is there any rule to use this function, If so then please let me know. Let me know if you have any other solution. Thanks and Regards,

          Manish Patel. B.E. - Information Technology.

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          Sample: CMenu* pMenu = GetMenu(); pMenu->ModifyMenu( ID_FILE_SAVE, 0, ID_FILE_SAVE, "New Save" );

          - NS - [ODBaseBtn]

          M 1 Reply Last reply
          0
          • N Nishad S

            Sample: CMenu* pMenu = GetMenu(); pMenu->ModifyMenu( ID_FILE_SAVE, 0, ID_FILE_SAVE, "New Save" );

            - NS - [ODBaseBtn]

            M Offline
            M Offline
            manish patel
            wrote on last edited by
            #5

            Sorry but i am not able to use it with System Tray popup menu. Actually i have used this library to create a System Tray pop up menu. http://www.codeproject.com/KB/shell/systemtray.aspx[^] So, Do you have any idea on this? Regards,

            Manish Patel. B.E. - Information Technology.

            N 1 Reply Last reply
            0
            • M manish patel

              Sorry but i am not able to use it with System Tray popup menu. Actually i have used this library to create a System Tray pop up menu. http://www.codeproject.com/KB/shell/systemtray.aspx[^] So, Do you have any idea on this? Regards,

              Manish Patel. B.E. - Information Technology.

              N Offline
              N Offline
              Nishad S
              wrote on last edited by
              #6

              I am not familiar with that library. Anyway if you have the menu handle, then you can surely update it. But I could find a BOOL SetMenuText(UINT uiCmd, LPCTSTR szText); in the documentation... Did you try that?

              - NS - [ODBaseBtn]

              1 Reply Last reply
              0
              • M manish patel

                Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,

                Manish Patel. B.E. - Information Technology.

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                You can add a UI handler for the menu item ON_UPDATE_COMMAND_UI and do something like

                void CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
                {
                pCmdUI->SetText("New Menu Text");
                }

                M 1 Reply Last reply
                0
                • M Maximilien

                  You can add a UI handler for the menu item ON_UPDATE_COMMAND_UI and do something like

                  void CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
                  {
                  pCmdUI->SetText("New Menu Text");
                  }

                  M Offline
                  M Offline
                  Mike Gaskey
                  wrote on last edited by
                  #8

                  Wanted to say, thanks for posting this. I had been scratching my head trying to figure out how to do this and was making it a far more difficult chore than it needed to be. This was the answer, so simple that I hadn't even considered it. worked perfectly by the way.

                  Mike - typical white guy. "Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a piece of shit by the clean end." Thomas Mann - "Tolerance becomes a crime when applied to evil." As American as: hot dogs, apple and Sarah Palin.

                  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