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. Disable Menu Items

Disable Menu Items

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 4 Posters 1 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.
  • J Offline
    J Offline
    Jay Hova
    wrote on last edited by
    #1

    Hi, I was wondering if someone could help me disable a menu option. Thank you for your help.

    J 1 Reply Last reply
    0
    • J Jay Hova

      Hi, I was wondering if someone could help me disable a menu option. Thank you for your help.

      J Offline
      J Offline
      Jason Henderson
      wrote on last edited by
      #2

      If you're using MFC, look up EnableMenuItem in the CMenu class documentation. If you're not using MFC, just look up EnableMenuItem.

      Jason Henderson

      "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it." - Jack Handey

      J 1 Reply Last reply
      0
      • J Jason Henderson

        If you're using MFC, look up EnableMenuItem in the CMenu class documentation. If you're not using MFC, just look up EnableMenuItem.

        Jason Henderson

        "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it." - Jack Handey

        J Offline
        J Offline
        Jay Hova
        wrote on last edited by
        #3

        Hi Jason, I don't have MSDN installed on this computer, I only remember off the top of my head its something like : EnableMenuItem((i think its the menuID?), Flags); Can you or someone shed some light to get this done with MFC? Thank you for your help!

        J J J 3 Replies Last reply
        0
        • J Jay Hova

          Hi Jason, I don't have MSDN installed on this computer, I only remember off the top of my head its something like : EnableMenuItem((i think its the menuID?), Flags); Can you or someone shed some light to get this done with MFC? Thank you for your help!

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #4

          Jay Hova wrote: don't have MSDN installed on this computer You can find it online at msdn.microsoft.com[^]. It is the one most valuable resource you need as a programmer. BTW - Your compiler came with a copy of MSDN.


          Who is 'General Failure'? And why is he reading my harddisk?!?

          1 Reply Last reply
          0
          • J Jay Hova

            Hi Jason, I don't have MSDN installed on this computer, I only remember off the top of my head its something like : EnableMenuItem((i think its the menuID?), Flags); Can you or someone shed some light to get this done with MFC? Thank you for your help!

            J Offline
            J Offline
            Jason Henderson
            wrote on last edited by
            #5

            BOOL EnableMenuItem( HMENU hMenu, // handle to menu UINT uIDEnableItem, // menu item to update UINT uEnable // options ); or // MFC CMenu UINT EnableMenuItem( UINT nIDEnableItem, UINT nEnable );

            Jason Henderson

            "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it." - Jack Handey

            1 Reply Last reply
            0
            • J Jay Hova

              Hi Jason, I don't have MSDN installed on this computer, I only remember off the top of my head its something like : EnableMenuItem((i think its the menuID?), Flags); Can you or someone shed some light to get this done with MFC? Thank you for your help!

              J Offline
              J Offline
              Jay Hova
              wrote on last edited by
              #6

              I have only been programming for a month, so please be patient. right now i am using the code i found on the msdn.microsoft.com site CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); I get the error that GetMenu doesn't take 0 parameters? Can someone tell me whats wrong. I used similar code if not the same, to get a couple other menu options checked/unchecked and it worked fine. Don't understand why it doesn't work. Oh yeah, I have no idea why msdn is not installed on this computer? its not my own.

              B 1 Reply Last reply
              0
              • J Jay Hova

                I have only been programming for a month, so please be patient. right now i am using the code i found on the msdn.microsoft.com site CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); I get the error that GetMenu doesn't take 0 parameters? Can someone tell me whats wrong. I used similar code if not the same, to get a couple other menu options checked/unchecked and it worked fine. Don't understand why it doesn't work. Oh yeah, I have no idea why msdn is not installed on this computer? its not my own.

                B Offline
                B Offline
                Brian Shifrin
                wrote on last edited by
                #7

                You are mixing CWnd::GetMenu/CWindow::GetMenu and ::GetMenu Win API: HMENU GetMenu( HWND hWnd ); From your mainframe class try calling GetMenu()... Brian

                J 1 Reply Last reply
                0
                • B Brian Shifrin

                  You are mixing CWnd::GetMenu/CWindow::GetMenu and ::GetMenu Win API: HMENU GetMenu( HWND hWnd ); From your mainframe class try calling GetMenu()... Brian

                  J Offline
                  J Offline
                  Jay Hova
                  wrote on last edited by
                  #8

                  I am calling this from my main class... I don't get it. I have almost the same exact code right beneath it and it works. (this is the code that checks the menu options) Thanks for helping

                  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