CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    117

    Hide/remove tool bar

    Hi guys,

    Is there some way of removing the toolbar from your program after you've created it?
    I added it when creating the software long ago but now I'd like to do without it.
    Simply deleting it doesn't seem to be possible.
    I've also tried editting the resource file, but after that the sofware won't compile any longer.

    Just to be clear, I'm talking about this toolbar; the one with the icons:
    http://i.msdn.microsoft.com/dynimg/IC142616.gif

    Thanks!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Hide/remove tool bar

    Quote Originally Posted by rmirani View Post
    ...
    I've also tried editting the resource file, but after that the sofware won't compile any longer.
    how did you "delete" it? And where from?
    Victor Nijegorodov

  3. #3
    Join Date
    Sep 2007
    Posts
    117

    Re: Hide/remove tool bar

    From the .rc file, where it says:

    /////////////////////////////////////////////////////////////////////////////
    //
    // Toolbar
    //

    IDR_MAINFRAME TOOLBAR DISCARDABLE 18, 17
    BEGIN
    BUTTON ID_FILE_NEW
    BUTTON ID_FILE_OPEN
    BUTTON ID_FILE_SAVE
    END

    Deleting that results in errors.

  4. #4
    Join Date
    Sep 2007
    Posts
    117

    Resolved Re: Hide/remove tool bar

    Ah, never mind.
    Found it!
    Sorry for the trouble.
    Whether to draw the toolbar or not can be set in CMainFrame, which contains the toolbar.
    It needs to be set in CMainFrame::OnCreate

    Code:
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    	.....; // leaving out the standard stuff here
    	.....;
    	.....;
    
    	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    	EnableDocking(CBRS_ALIGN_ANY);
    	DockControlBar(&m_wndToolBar);
    
    	BOOL SHOWTOOLBAR=FALSE;
    
    	ShowControlBar(&m_wndToolBar, SHOWTOOLBAR, FALSE);
    
    	return 0;
    }
    Thanks for the help!
    Last edited by rmirani; November 11th, 2011 at 01:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured