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. Problem in Disable System menu

Problem in Disable System menu

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

    Hi, In my project i want to disable and enable Main Menu at run time using mfc . I had try to run the following code, but don't send error occurred CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Please help me How to Disable/Enable Main Menu using View class

    V 1 Reply Last reply
    0
    • M mohindar_kks

      Hi, In my project i want to disable and enable Main Menu at run time using mfc . I had try to run the following code, but don't send error occurred CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Please help me How to Disable/Enable Main Menu using View class

      V Offline
      V Offline
      Venkata Rama Subbarao
      wrote on last edited by
      #2

      I don't think we can work on Menus using View object. try to get the MainWindow handle and use that handle for obtaining menus. CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Try this and i hope this will work fine.

      M 1 Reply Last reply
      0
      • V Venkata Rama Subbarao

        I don't think we can work on Menus using View object. try to get the MainWindow handle and use that handle for obtaining menus. CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Try this and i hope this will work fine.

        M Offline
        M Offline
        mohindar_kks
        wrote on last edited by
        #3

        Hi I had work with following code in view class, but Debug assertion failed had occured. code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);

        D 1 Reply Last reply
        0
        • M mohindar_kks

          Hi I had work with following code in view class, but Debug assertion failed had occured. code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          mohindar_kks wrote:

          ...but Debug assertion failed had occured.

          What line of what file is asserting?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          M 1 Reply Last reply
          0
          • D David Crow

            mohindar_kks wrote:

            ...but Debug assertion failed had occured.

            What line of what file is asserting?


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            M Offline
            M Offline
            mohindar_kks
            wrote on last edited by
            #5

            Hi I had solved Debug assertion failed problem. Problem : Not disable menu with gray color from the following code code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);

            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