c++mfctoolbarcmfctoolbarcmfcpropertypage

How to hide CMFCToolBar from customize dialog Toolbar property page?


I am working on Mfc application that contains ribbon and some toolbars. I made a CMFCToolBar dummy object to store all the icons from ribbon tabs and use it later.

I have hidden the dummy toolbar from the UI. but couldn't hide from customize dialog Toolbar Property Page. Image(untitled bar is the dummy toolbar)

I dont want the user to see the dummy toolbar in the property page. For this I have also made CMFCToolBarsCustomizeDialog extension and inherited the ShowToolBar Function but it is not working.

Code:

void ShowToolBar(CMFCToolBar* pToolBar, BOOL bShow)
    {
        this->m_pToolbarsPage->ShowToolBar(pToolBar, bShow);
    }

Solution

  • Simply override CMFCToolBar::AllowShowOnList and return FALSE.

    BOOL CMyToolBar::AllowShowOnList() const 
    { 
      return FALSE;
    }