4

Can you use CMFCVisualManager with a dialog based application to change the applications appearance? If so how is it done?

The idea is to change the shape, colour etc. of controls such as push buttons using the MFC Feature Pack released with MSVC 2008.

prakash
  • 58,901
  • 25
  • 93
  • 115
John W
  • 426
  • 1
  • 5
  • 10

4 Answers4

2

No, can't be done, at least not if you're talking about the Feature Pack version. Version 10 of the BCGSoft libraries do have this functionality, see for example: http://www.bcgsoft.com/bcgcontrolbarpro-versions.htm and http://www.bcgsoft.com/images/SkinnedBuiltInDlgs.jpg. The MFC feature pack is more or less the previous version of the BCGSoft libraries, MS bought a license from them.

Roel
  • 19,338
  • 6
  • 61
  • 90
0

I think you can have some MFC-feature-pack features by implementing OnApplicationLook on your base CDialog (check Step 4 on this page). It might be better to implement the whole OnApplicationLook method, but you can test your application simply by adding this to OnInitDialog:

CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
CDockingManager::SetDockingMode(DT_SMART);
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
djeidot
  • 4,542
  • 4
  • 42
  • 45
0

This is the least amount of code to enable the Visual Styles. You should be able to pop your CDialog into the frame easily. The IDR_MAINFRAME is a menu resource.

class CMFCApplication2Dlg : public CFrameWndEx
{
    CMFCMenuBar bar;
public:
    CMFCApplication2Dlg() : CFrameWndEx()
    {
        LoadFrame(IDR_MAINFRAME);
        bar.Create(this);
    }
};

class CMFCApplication2App : public CWinAppEx
{
public:
    virtual BOOL InitInstance()
    {
        CWinAppEx::InitInstance();

        CMFCVisualManagerOffice2007::SetStyle(
            CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);

        CMFCVisualManager::SetDefaultManager(
            RUNTIME_CLASS(CMFCVisualManagerOffice2007));

        SetRegistryKey(_T("Local AppWizard-Generated Applications"));

        m_pMainWnd = new CMFCApplication2Dlg();

        m_pMainWnd->ShowWindow(SW_SHOW);
        m_pMainWnd->UpdateWindow();

        return TRUE;
    }
};

CMFCApplication2App theApp;
0

You need to add the Common Controls manifest to your project resources. Here is the code for the manifest file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
 version="1.0.0.0"
 processorArchitecture="X86"
 name="Program Name"
 type="win32"
/>
<description>Description of Program</description>
<dependency>
 <dependentAssembly>
 <assemblyIdentity
   type="win32"
   name="Microsoft.Windows.Common-Controls"
   version="6.0.0.0"
   processorArchitecture="X86"
   publicKeyToken="6595b64144ccf1df"
   language="*"
 />
 </dependentAssembly>
</dependency>
</assembly>
djeidot
  • 4,542
  • 4
  • 42
  • 45
  • This will only enable the Common Controls V6 (aka Windows XP look). What the OP was after, was the 'themed' look (Office 2007 style, VS2005, or any of the others that are included in MFC Next. – Roel Sep 30 '08 at 08:31