How can I switch my existing MFC application to BCGControlBar library?

First of all, BCGControlBar library doesn't replace MFC, it just enhances it. So unless you have in use some tricky methods (such as subclassing MDI client area window), this process should be easy. Here we'll try to guide you through the basic steps that you should make:
  1. Add #include "BCGCBProInc.h" to your stdafx.h. The project will be linked with the appropriated BCGControlBarlibrary automatically.
  2. Derive your application class from CBCGPWinApp:

    class CMyApp : public CBCGPWinApp

  3. Make sure, that you call AfxOleInit() in your application InitInstance()
  4. Add the following call to InitInstance(): SetRegistryKey(_T("MyCompany\\MyProduct"));
  5. Call BCGCBProCleanUp() in you application's ExitInstance() method.
  6. Change CMainFrame base class:
    • SDI application: replace CFrameWnd with CBCGPFrameWnd
    • MDI application: replace CMDIFrameWnd with CBCGPMDIFrameWnd and CMDIChildWnd to CBCGPMDIChildWnd
    • Replace COleIPFrameWnd with CBCGPOleIPFrameWnd
    (Important: please make these change everywhere, not in the class declaration only!)

  7. Change CToolBar to CBCGPToolBar. Please note, if you are calling CToolBar method SetSizes with different values for several toolbars, it doesn't work! CBCGPToolBar:: SetSizes is a static method because all toolbar's buttons have to have the same size.

  8. If you would like to add a menu bar (MS Office-like dockable control bar with a menu), just add the following member to CMainFrame class: CBCGPMenuBar m_wndMenuBar and initialize it in the same way as the toolbar member (see example code).
  9. Set the application visual style at the beginning of your CMainFrame::OnCreate():


    where the manager is one of:
    • CBCGPVisualManager - MS Office 2000 look
    • CBCGPVisualManagerXP - MS Office XP look
    • CBCGPVisualManager2003 - MS Office 2003 look
    • CBCGPVisualManager2007 - MS Office 2007 look
    • CBCGPVisualManagerVS2005 - Visual Studio 2005 look
    • CBCGPVisualManagerVS2008 - Visual Studio 2008 look
    • CBCGPVisualManager2010 - MS Office 2010 look
    • CBCGPVisualManagerVS2010 - Visual Studio 2010 look
    • CBCGPVisualManagerVS2012 - Visual Studio 2012 look
    • CBCGPVisualManagerVS2013 - Visual Studio 2013/2015 look
    • CBCGPVisualManager2013 - MS Office 2013 look
    • CBCGPVisualManager2016 - MS Office 2016 look
    • CBCGPWinXPVisualManager - Windows native look.
Creation date: 10/16/2016 11:26 AM ()      Updated: 10/16/2016 11:27 AM ()