BCGControlBar Pro for MFC
Getting Started

Please make the following changes in your source code:

  • Add BCGCBPro directory to INCLUDE path
  • Add the following include to the stdafx.h file:
    Copy
    #include "BCGCBProInc.h"
  • Derive your application class from CBCGPWinApp:
    Copy
    class CMyApp: public CBCGPWinApp
  • Specify your application general options in the application class constructor:
  • Toolbar options. (If you wish to use MS Office-style Ribbon bar, please skip this) To enable toolbar/menu customization, add a new item ID_VIEW_CUSTOMIZE to your strings resources and add the following code to application constructor:
    Copy
    CBCGPToolbarOptions toolbarOptions;
    toolbarOptions.m_nViewToolbarsMenuEntryID = ID_VIEW_TOOLBAR; // Will be replaced with toolbars menu
    toolbarOptions.m_nCustomizeCommandID = ID_VIEW_CUSTOMIZE; // You don't need to add item to any toolbars/menus
    toolbarOptions.m_strCustomizeCommandLabel = _T("Customize...");
    SetToolbarOptions(toolbarOptions);
  • Make sure, that you call CBCGPWinApp::InitInstance() and AfxOleInit() in your application InitInstance()
  • Next, you need to define where your application data will be saved in the registry. To do it, in CMyApp::InitInstance specify a registry entry (the suggested code location is after LoadStdProfileSettings):
    Copy
    LoadStdProfileSettings();
    SetRegistryBase(_T("Settings"));
  • Change CMDIFrameWnd to CBCGPMDIFrameWnd both in mainframe.h and mainframe.cpp files (in case of SDI application change CFrameWnd to CBCGPFrameWnd)
  • Change CMDIChildWnd to CBCGPMDIChildWnd (MDI applications only).
  • Change CToolbar to CBCGPToolBar and add an embedded menu bar object into your CMainFrame class:
    Copy
    CBCGPMenuBar m_wndMenuBar; // New menu bar
    CBCGPToolBar m_wndToolBar; // Application toolbar
  • In CMainFrame::OnCreate() method add the following lines to enable the menu bar functionality:
    Copy
    // Create menu bar (replaces the standard menu):
    if(!m_wndMenuBar.Create(this))
    {
    TRACE0("Failed to create menubar\n");
    return-1; // fail to create
    }
    m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  • To enable menu bar docking, add the following code:
    Copy
    m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);
    DockControlBar(&m_wndMenuBar);
  • Important: you can use any number of CBCGPToolBar toolbars in your application. All toolbar images will be automatically merged into the one bitmap image. However, only one CBCGPMenuBar object can be used.

    If you wish to replace toolbars and menus with MS Office-style Ribbon Bar, please read the following on-line article: https://bcgsoft.com/Support/DevArea/RibbonDesigner

    To enable user-defined tools: