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 disable a menu button

How to disable a menu button

Scheduled Pinned Locked Moved C / C++ / MFC
jsontutorial
4 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.
  • C Offline
    C Offline
    Caoimh
    wrote on last edited by
    #1

    Hi, any idea on how to disable a menu button. What I mean is, consider internet explorer browser the menu consists of 'File', if you click on it a drop down menu appears, what api could I use to disable the close button. Kind Regards Caoimh

    R S 2 Replies Last reply
    0
    • C Caoimh

      Hi, any idea on how to disable a menu button. What I mean is, consider internet explorer browser the menu consists of 'File', if you click on it a drop down menu appears, what api could I use to disable the close button. Kind Regards Caoimh

      R Offline
      R Offline
      RChin
      wrote on last edited by
      #2

      If you are using the MFC in your application, you can handle the ON_UPDATE_COMMAND_UI handler for your menu item (you can do this via Class wizard). Then its a matter of setting the state of your item pCmdUI->Enable(isEnabled?TRUE:FALSE);


      I Dream of Absolute Zero

      1 Reply Last reply
      0
      • C Caoimh

        Hi, any idea on how to disable a menu button. What I mean is, consider internet explorer browser the menu consists of 'File', if you click on it a drop down menu appears, what api could I use to disable the close button. Kind Regards Caoimh

        S Offline
        S Offline
        Steve S
        wrote on last edited by
        #3

        If you aren't using MFC, then you can get the menu handle for the window (normally the top level window), and then get a handle for the sub-menu from there (they start at zero, of course!), and finally modify the state of a given item. APIs to check out are: HMENU GetMenu( HWND hWnd ); HMENU GetSubMenu( HMENU hMenu, int nSub ); BOOL SetMenuItemInfo( HMENU hMenu, UINT uItem, BOOL fByPos, LPMENUITEMINFO lpmii); That should take care of most things. Steve S

        C 1 Reply Last reply
        0
        • S Steve S

          If you aren't using MFC, then you can get the menu handle for the window (normally the top level window), and then get a handle for the sub-menu from there (they start at zero, of course!), and finally modify the state of a given item. APIs to check out are: HMENU GetMenu( HWND hWnd ); HMENU GetSubMenu( HMENU hMenu, int nSub ); BOOL SetMenuItemInfo( HMENU hMenu, UINT uItem, BOOL fByPos, LPMENUITEMINFO lpmii); That should take care of most things. Steve S

          C Offline
          C Offline
          Caoimh
          wrote on last edited by
          #4

          I'm using MFCs

          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