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. Removing ToolBar & Menu

Removing ToolBar & Menu

Scheduled Pinned Locked Moved C / C++ / MFC
help
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi, I created an SDI Application.I want remove the Toolbar and Menu from my Application. For that I created a Class from CFrameWnd and attached it to the DocumentTemplate and Changed the dafault menu item as NULL.I am getting the output window with a lot of assertion failure.What all steps I need to follow to remove the ToolBar and Menu from the Application. Help please. SSN

    B P 2 Replies Last reply
    0
    • L Lost User

      Hi, I created an SDI Application.I want remove the Toolbar and Menu from my Application. For that I created a Class from CFrameWnd and attached it to the DocumentTemplate and Changed the dafault menu item as NULL.I am getting the output window with a lot of assertion failure.What all steps I need to follow to remove the ToolBar and Menu from the Application. Help please. SSN

      B Offline
      B Offline
      Brian V Shifrin
      wrote on last edited by
      #2

      *IF* you are using VC6, Removing Menu: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.hMenu = NULL; return CFrameWnd::PreCreateWindow(cs); } I belive previous version of MFC were getting p*ssed if you try this... So old aproach was create window with menu. Create own message WM_APP+100, post this message from OnCreate, and when you get this message do something like this: HMENU h = GetMenu(); SetMenu(NULL); DestroyMenu(h); Toolbar is easy, change on create to look something like this: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; return 0; }

      L 1 Reply Last reply
      0
      • L Lost User

        Hi, I created an SDI Application.I want remove the Toolbar and Menu from my Application. For that I created a Class from CFrameWnd and attached it to the DocumentTemplate and Changed the dafault menu item as NULL.I am getting the output window with a lot of assertion failure.What all steps I need to follow to remove the ToolBar and Menu from the Application. Help please. SSN

        P Offline
        P Offline
        Philip Patrick
        wrote on last edited by
        #3

        The toolbar you can remove when you are creating your SDI application, you'll find an option, to create or not to create the tool bar there. To remove menu, you have to override CFrameWnd::LoadFrame() of your Frame window and place a code inside it, like this:

        BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) {   BOOL bRetVal = CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);   if(bRetVal){     GetMenu()->DestroyMenu();     SetMenu(NULL);   }   return bRetVal; }

        Philip Patrick "Two beer or not two beer?" Web-site: www.saintopatrick.com

        1 Reply Last reply
        0
        • B Brian V Shifrin

          *IF* you are using VC6, Removing Menu: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.hMenu = NULL; return CFrameWnd::PreCreateWindow(cs); } I belive previous version of MFC were getting p*ssed if you try this... So old aproach was create window with menu. Create own message WM_APP+100, post this message from OnCreate, and when you get this message do something like this: HMENU h = GetMenu(); SetMenu(NULL); DestroyMenu(h); Toolbar is easy, change on create to look something like this: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; return 0; }

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Thanks a Lot SSN

          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