Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / MFC

The Ultimate Toolbox Application Skins

Rate me:
Please Sign up or sign in to vote.
5.00/5 (19 votes)
24 Aug 2007CPOL2 min read 168.2K   4.9K   58   40
The Ultimate Toolbox supports Office XP, Office 2003, and Classic application skins

Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.

Source code and project files for this sample can be found in the samples\advanced\SkinsDemo directory of the sample projects download.

Overview

Image 1

The Skins Demo demonstrates the skinning framework available in The Ultimate Toolbox library. You can choose between the Office 2003, Office XP and Classic skins, and you can also change skins dynamically when the application is running.

Setting a Skin to Your Application

  1. Derive your application class from COXSkinnedApp instead of from CWinApp. Do not forget to include OXSkins.h.
  2. Derive your main frame window from COXMenuBarFrame<CMDIFrameWnd, COXSizeDockBar> instead of from CMDIFrameWnd for MDI applications. For SDI applications, derive your main frame window from COXMenuBarFrame<CFrameWnd, COXSizeDockBar> instead of from CFrameWnd.
  3. In the constructor of your main frame class call the constructor of COXMenuBarFrame<…> and pass CBRS_ALIGN_ANY for the first parameter and RUNTIME_CLASS(COXSizableMiniDockFrameWnd) for the second parameter.
  4. Derive or instantiate your toolbars from COXCoolToolBar instead of from CToolBar.
  5. Add an instance of COXBitmapMenuOrganizer to your main frame class. In the WM_CREATE handler of your main frame window call COXBitmapMenuOrganizer::AttachFrameWnd(…) and then COXBitmapMenuOrganizer:: AutoSetMenuImage(…).
  6. Add an instance of COXTabClientWnd to your main frame class. This will enable the MDI tabs. In the WM_CREATE handler of your main frame window call COXTabClientWnd::Attach(...).
  7. Derive or instantiate your status bar from COXStatusBar instead of CStatusBar.
  8. Derive your view class from COXSkinedView<PARENT>, where PARENT is the class from which your view was previously derived.

In the very beginning of your application class's InitInstance call SetCurrentSkin(_T("<skin name here>")). Choose from "Classic", "Office XP", and "Office 2003" skins. You can call this method again at any time to allow the user to switch between skins.

If you are having trouble following these steps they way they are outlined, just open the SkinsDemo project and do a text search for "STEP". You will find specific comments in all the places where the code needs to be modified:

Here is the related code which shows these actions in more detail:

C++
// STEP 1 - Derive your application class from COXSkinnedApp insted of 

// CWinApp.

class CSkinsDemoApp : public COXSkinnedApp
{
public:
    CSkinsDemoApp();
    ...

 
// STEP 2 - Derive you main frame window from COXMenuBarFrame<cmdiframewnd, />.

class CMainFrame : public COXMenuBarFrame<cmdiframewnd, />
{
    DECLARE_DYNAMIC(CMainFrame)
public:
    CMainFrame();
    ... 

 
// STEP 3 - Call the constructor of COXMenuBarFrame<cmdiframewnd, /> and

//        pass CBRS_ALIGN_ANY for the first parameter and

//        RUNTIME_CLASS(COXSizableMiniDockFrameWnd) for the second parameter

CMainFrame::CMainFrame() : 
    COXMenuBarFrame<cmdiframewnd,coxsizedockbar />(CBRS_ALIGN_ANY,
    RUNTIME_CLASS(COXSizableMiniDockFrameWnd))
{   ...

// STEP 4 - Derive or instantiate your toolbars from COXCoolToolBar instead 

// of CToolBar.

    COXCoolToolBar m_wndToolBar;
    COXCoolToolBar m_wndToolBar2;

// STEP 5 - Add an instance of COXBitmapMenuOrganizer to your main frame 

// class. This will enable your menus to show bitmaps.

    COXBitmapMenuOrganizer m_BMO;

// STEP 5 (Cont'd) - Call COXBitmapMenuOrganizer::AttachFrameWnd(...) and then

//    COXBitmapMenuOrganizer::AttachFrameWnd(...)

m_BMO.AttachFrameWnd(this);
m_BMO.AutoSetMenuImage();        // (place this code in the OnCreate handler 

                                 // of your CMainFrame class)


// STEP 6 - Add an instance of COXTabClientWnd to your main frame class. 

// This will enable the MDI tabs.

COXTabClientWnd m_MTIClientWnd;

// STEP 6 (Cont'd) - Call COXTabClientWnd::Attach(...) in the OnCreate() of 

// the main frame class

m_MTIClientWnd.Attach(this);

// STEP 7 - Derive or instantiate your status bar from COXStatusBar instead 

// of CStatusBar.

COXStatusBar m_wndStatusBar;

// STEP 8: Derive your view class from COXSkinnedView<...>

#define BASEVIEW CView
class CSkinsDemoView : public COXSkinnedView<baseview />
{
protected: // create from serialization only

History

Initial CodeProject release August 2007.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

Comments and Discussions

 
BugThe executable on this article gets flagged as a Trojan/Windows can't remove it Pin
Member 1365955510-Feb-24 19:06
Member 1365955510-Feb-24 19:06 
GeneralRe: The executable on this article gets flagged as a Trojan/Windows can't remove it Pin
Nelek10-Feb-24 19:09
protectorNelek10-Feb-24 19:09 
GeneralRe: The executable on this article gets flagged as a Trojan/Windows can't remove it Pin
Sean Ewington12-Feb-24 6:39
staffSean Ewington12-Feb-24 6:39 
GeneralRe: The executable on this article gets flagged as a Trojan/Windows can't remove it Pin
Member 1365955518-Feb-24 11:28
Member 1365955518-Feb-24 11:28 
QuestionImport application skins? Pin
seccpur13-Aug-15 16:50
seccpur13-Aug-15 16:50 
GeneralMessage Closed Pin
18-Jun-14 23:45
Amin Azadbakht18-Jun-14 23:45 
QuestionI would love ot use this, but I have a problem Pin
namezero11111112-Sep-12 7:50
namezero11111112-Sep-12 7:50 
QuestionCan't download 0KB file Pin
introcosmo8-Feb-12 4:16
introcosmo8-Feb-12 4:16 
GeneralErrors in VS 2010 Beta2 Pin
Ahamad Alisha23-Nov-09 5:21
Ahamad Alisha23-Nov-09 5:21 
QuestionSkins and HTML Help Pin
chrisb4411-Nov-09 18:16
chrisb4411-Nov-09 18:16 
AnswerRe: Skins and HTML Help Pin
chrisb4411-Nov-09 23:11
chrisb4411-Nov-09 23:11 
QuestionWhy I got Error Link? Pin
Cuongfdd16-Jun-09 19:11
Cuongfdd16-Jun-09 19:11 
Hello everyone,

I use SDI in VC6.0, I test my project with Skinsdemo, setting my project as in Start.
When I build this project, It shows Error Link below:

How can I resolve all error?

Thanks and Best regards,
Cuong
//========================================================================================

Deleting intermediate files and output files for project 'TestSkill - Win32 Debug'.
--------------------Configuration: TestSkill - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
MainFrm.cpp
TestSkill.cpp
TestSkillDoc.cpp
TestSkillView.cpp
C:\Mycode\SmartLight\samples\advanced\TestSkill\TestSkillView.cpp(56) : warning C4100: 'pDC' : unreferenced formal parameter
Generating Code...
Linking...
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXTabClientWnd::~COXTabClientWnd(void)" (??1COXTabClientWnd@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXBitmapMenuOrganizer::~COXBitmapMenuOrganizer(void)" (??1COXBitmapMenuOrganizer@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXCoolToolBar::~COXCoolToolBar(void)" (??1COXCoolToolBar@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXStatusBar::COXStatusBar(void)" (??0COXStatusBar@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXTabClientWnd::COXTabClientWnd(void)" (??0COXTabClientWnd@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXBitmapMenuOrganizer::COXBitmapMenuOrganizer(void)" (??0COXBitmapMenuOrganizer@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXCoolToolBar::COXCoolToolBar(void)" (??0COXCoolToolBar@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const COXSizableMiniDockFrameWnd::classCOXSizableMiniDockFrameWnd" (?classCOXSizableMiniDockFrameWnd@COXSizableMiniDockFrameWnd@@2UCRuntimeClass@@B)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXStatusBar::~COXStatusBar(void)" (??1COXStatusBar@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: void __thiscall COXCoolToolBar::EnableDocking(unsigned long,int)" (?EnableDocking@COXCoolToolBar@@QAEXKH@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXStatusBar::SetIndicators(unsigned int const *,int)" (?SetIndicators@COXStatusBar@@QAEHPBIH@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXMenuBar::SetMenu(struct HMENU__ *)" (?SetMenu@COXMenuBar@@QAEHPAUHMENU__@@@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXMenuBar::Create(class CWnd *,unsigned long,unsigned int)" (?Create@COXMenuBar@@QAEHPAVCWnd@@KI@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "int __stdcall AdvancedAssertFailedLine(unsigned short const *,char const *,int)" (?AdvancedAssertFailedLine@@YGHPBGPBDH@Z)
TestSkillView.obj : error LNK2001: unresolved external symbol "int __stdcall AdvancedAssertFailedLine(unsigned short const *,char const *,int)" (?AdvancedAssertFailedLine@@YGHPBGPBDH@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXMenuBar::HitTest(class CPoint const &,enum _tagHITTESTORIGIN)const " (?HitTest@COXMenuBar@@QBEHABVCPoint@@W4_tagHITTESTORIGIN@@@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXMenuBar::HandleMenuKey(unsigned int)" (?HandleMenuKey@COXMenuBar@@QAEHI@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "protected: int __thiscall COXMenuBar::RecreateMenuBar(int)" (?RecreateMenuBar@COXMenuBar@@IAEHH@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXMenuBar::~COXMenuBar(void)" (??1COXMenuBar@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: void __thiscall COXCoolToolBar::SetAdvancedCustomizationMode(int,struct HWND__ *)" (?SetAdvancedCustomizationMode@COXCoolToolBar@@QAEXHPAUHWND__@@@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXMenuBar::COXMenuBar(void)" (??0COXMenuBar@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall COXSizeDockBar::GetMessageMap(void)const " (?GetMessageMap@COXSizeDockBar@@MBEPBUAFX_MSGMAP@@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall COXSizeDockBar::Dump(class CDumpContext &)const " (?Dump@COXSizeDockBar@@UBEXAAVCDumpContext@@@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall COXSizeDockBar::GetRuntimeClass(void)const " (?GetRuntimeClass@COXSizeDockBar@@UBEPAUCRuntimeClass@@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall COXSizeDockBar::~COXSizeDockBar(void)" (??1COXSizeDockBar@@UAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall COXSizeDockBar::COXSizeDockBar(void)" (??0COXSizeDockBar@@QAE@XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual class CSize __thiscall COXSizeDockBar::CalcFixedLayout(int,int)" (?CalcFixedLayout@COXSizeDockBar@@UAE?AVCSize@@HH@Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const COXMenuBar::classCOXMenuBar" (?classCOXMenuBar@COXMenuBar@@2UCRuntimeClass@@B)
TestSkill.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall COXSkinnedApp::GetRuntimeClass(void)const " (?GetRuntimeClass@COXSkinnedApp@@UBEPAUCRuntimeClass@@XZ)
TestSkill.obj : error LNK2001: unresolved external symbol "protected: __thiscall COXSkinnedApp::COXSkinnedApp(void)" (??0COXSkinnedApp@@IAE@XZ)
TestSkill.obj : error LNK2001: unresolved external symbol "protected: virtual __thiscall COXSkinnedApp::~COXSkinnedApp(void)" (??1COXSkinnedApp@@MAE@XZ)
TestSkill.obj : error LNK2001: unresolved external symbol "public: int __thiscall COXSkinnedApp::SetCurrentSkin(unsigned short const *)" (?SetCurrentSkin@COXSkinnedApp@@QAEHPBG@Z)
TestSkillView.obj : error LNK2001: unresolved external symbol "public: class COXFrameSkin * __thiscall COXSkin::GetFrameSkin(void)const " (?GetFrameSkin@COXSkin@@QBEPAVCOXFrameSkin@@XZ)
TestSkillView.obj : error LNK2001: unresolved external symbol "public: class COXSkin * __thiscall COXSkinnedApp::GetCurrentSkin(void)" (?GetCurrentSkin@COXSkinnedApp@@QAEPAVCOXSkin@@XZ)
TestSkillView.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const COXSkinnedApp::classCOXSkinnedApp" (?classCOXSkinnedApp@COXSkinnedApp@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/TestSkill.exe : fatal error LNK1120: 35 unresolved externals
Error executing link.exe.

TestSkill.exe - 37 error(s), 1 warning(s)
AnswerRe: Why I got Error Link? Pin
Tim Deveaux17-Jun-09 14:03
Tim Deveaux17-Jun-09 14:03 
GeneralRe: Why I got Error Link? Pin
Cuongfdd17-Jun-09 16:33
Cuongfdd17-Jun-09 16:33 
Generali could not make it to use the OXCustumizeManager Pin
MewMew200029-Jan-09 6:25
MewMew200029-Jan-09 6:25 
QuestionCan not redraw the menu Pin
JobsGuo14-Dec-08 18:29
JobsGuo14-Dec-08 18:29 
AnswerRe: Can not redraw the menu Pin
Tim Deveaux15-Dec-08 13:23
Tim Deveaux15-Dec-08 13:23 
GeneralRe: Can not redraw the menu Pin
JobsGuo21-Dec-08 21:21
JobsGuo21-Dec-08 21:21 
QuestionOffice 2003 Skin with MDI exe [modified] Pin
Brandybuck3-Nov-08 7:32
Brandybuck3-Nov-08 7:32 
GeneralProblems with the control title in the TabViewBar and 3DTabViewBar Controls [modified] Pin
mapharo30-May-08 10:23
mapharo30-May-08 10:23 
GeneralRe: Problems with the control title in the TabViewBar and 3DTabViewBar Controls Pin
Tim Deveaux4-Jun-08 14:29
Tim Deveaux4-Jun-08 14:29 
QuestionSkins not working when a toolbar is located in a dll Pin
Wunni11-Feb-08 21:57
Wunni11-Feb-08 21:57 
GeneralRe: Skins not working when a toolbar is located in a dll Pin
Tim Deveaux13-Feb-08 7:12
Tim Deveaux13-Feb-08 7:12 
GeneralCouldn't compile in VS 2008 Pin
Ahamad Alisha2-Jan-08 5:06
Ahamad Alisha2-Jan-08 5:06 
GeneralUI styles in Dialog based app Pin
canercaner8-Nov-07 9:20
canercaner8-Nov-07 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.