Click here to Skip to main content
13,193,468 members (24,740 online)
Click here to Skip to main content
Add your own
alternative version


125 bookmarked
Posted 17 Jul 2001

Using Skins Without MFC

, 17 Jul 2001
Rate this:
Please Sign up or sign in to vote.
A Simple Skinning Library
<!-- Download Links --> <!-- Article image -->

Sample Image - SkinStyle.jpg

<!-- Main HTML starts here -->


SkinStyle is a picture based skin system written in Visual C++/Win32 and loosely based on Cuneyt Elibol's MFC/SkinSys. The major difference is SkinStyle is written without any MFC. Much of the functionality found in SkinSys is not found in this version of SkinStyle.


  • SkinStyle Source
  • A Simple Example

Download Directories

Once you download and extract the files, you'll see several new folders. Here is what each are used for.

  • Root : The SkinStyle Code
  • SkinTest : An Example Project And Skin


Create a class that inherits from SkinDialog

class KSkinTest : public SkinDialog
	// here we are overriding the OnKeyDown member of SkinDialog
	// so the app will exit on ESC
	virtual void OnKeyDown(WPARAM wParam, LPARAM lParam)
		if ( wParam == VK_ESCAPE )
			::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
	// we also override the OnButtonPressed member of SkinDialog
	// to catch the user pushing one of the buttons
	virtual BOOL OnButtonPressed(char *ButtonName);


Now lets look at how to handle buttons being pressed...

// This member function is called with the name of the button being pressed
BOOL KSkinTest::OnButtonPressed(char *ButtonName)
	if(strcmp(ButtonName, "BUTTON_EXIT") == 0)
		::PostMessage(m_hWnd, WM_CLOSE, 0, 0);

	else if(strcmp(ButtonName, "BUTTON_MINIMIZE") == 0)
		::ShowWindow(m_hWnd, SW_MINIMIZE);

	else if(strcmp(ButtonName, "YOUR_DEFINED_BUTTON") == 0)
		// Do Something...
	return FALSE;

Once you have defined your new dialog class it can be used in WinMain like this

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR lpCmd, int nShow)
	KSkinTest win;

	HWND hParent;

	// GetFile is a user defined function that returns a file with the full path...

	char *SkinFile = GetFile(NULL);

	if(SkinFile[0] == 0) 
		return 0;

	// here we create the dialog
	hParent = win.CreateEx("SkinTest", 	// Text in caption
				CW_USEDEFAULT, 	// x coord
				CW_USEDEFAULT, 	// y coord
				hInst, 		// HINSTANCE
				SkinFile);	// full path of skin file

	win.SetSticky(true);	// make the dialog sticky

	win.ShowWindow(nShow);	// Show the new dialog
	win.UpdateWindow();	// Update it

	return win.MessageLoop();	// Enter the message loop

Skin file format

A Skin file consists of three parts (more to come later)

  • [SCREEN] : This section contains the image files to display
    • Mask : This specifies the mask image for the dialog
    • Main : This specifies the main image for the dialog
    • Down : This specifies the image displayed when a widget is pressed
    • Over : This specifies the image displayed when the mouse is over a sensitive widget
    • Disabled : This specifies the image displayed when the dialog is inactive

  • [BUTTONINFO] : This section contains a numbered list of buttons to display
    • #=BUTTON_NAME,x,y,width,height,TOOL_TIP,FALSE

  • [TEXTINFO] : This section contains a numbered list of labels to display

For example:


2=BUTTON_BABEL,12,425,43,19,Babel Preferences,FALSE
4=BUTTON_STATUS,119,425,25,19,User Status,FALSE

1=TEXT_STATUS,Courier New,FALSE,TRUE,-8,3496550,136,424,64,6,Offline,User Status


At this stage I am unable to reload skins at run time? This is apparent in the sample app.

Additional Notes

This is by no means a finished product! This is my first attempt at writing a terribly complicated Win32 application library. I wanted something similar to SkinSys in functionality but without the overhead of MFC. There will be bugs and errors! I hope that you find this code useful. If you have any improvements/suggestions, comments/flames, or questions please e-mail me or post here.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

John Roark
Software Developer (Senior)
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionVery basic, but works fine Pin
merano8-Jul-12 9:40
membermerano8-Jul-12 9:40 
Generalnice work! think you! Pin
sfengtfw8-Apr-08 20:14
membersfengtfw8-Apr-08 20:14 
nice work! think you!


GeneralUse that with c# Pin
daniel2023-Mar-08 8:49
memberdaniel2023-Mar-08 8:49 
GeneralThe SKIN "down" doesn't work Pin
mau.deg26-Oct-06 6:59
membermau.deg26-Oct-06 6:59 
GeneralRe: The SKIN "down" doesn't work Pin
merano8-Jul-12 9:32
membermerano8-Jul-12 9:32 
GeneralImprovements Pin
sk8er_boy2874-Oct-06 4:37
membersk8er_boy2874-Oct-06 4:37 
GeneralRe: Improvements Pin
mau.deg22-Oct-06 22:52
membermau.deg22-Oct-06 22:52 
GeneralMoving the window. Pin
Death2-Feb-05 9:51
memberDeath2-Feb-05 9:51 
GeneralRe: Moving the window. Pin
John Roark2-Feb-05 10:03
memberJohn Roark2-Feb-05 10:03 
GeneralRe: Moving the window. Pin
Death2-Feb-05 10:13
memberDeath2-Feb-05 10:13 
QuestionHow to Skin a Window Pin
Saifadam Pathan21-Apr-04 20:37
memberSaifadam Pathan21-Apr-04 20:37 
Generalwhy can't resize the dialog Pin
fbhyq@21cn.com29-Sep-03 18:16
memberfbhyq@21cn.com29-Sep-03 18:16 
GeneralSkinMagic Toolkit Pin
jedyking13-Apr-03 4:56
memberjedyking13-Apr-03 4:56 
GeneralRe: SkinMagic Toolkit Pin
aiker25-Nov-03 18:00
memberaiker25-Nov-03 18:00 
QuestionMicrosoft Web Browser Object into DialogBox, without MFC? Pin
Adrian Bacaianu8-Apr-03 20:56
memberAdrian Bacaianu8-Apr-03 20:56 
GeneralRe: Another way for skinnable application Pin
The ~Coder12-Apr-03 12:48
sussThe ~Coder12-Apr-03 12:48 
GeneralRe: Another way for skinnable application Pin
CoolTool13-Apr-03 8:09
sussCoolTool13-Apr-03 8:09 
GeneralRe: Another way for skinnable application Pin
The ~Coder13-Apr-03 8:26
sussThe ~Coder13-Apr-03 8:26 
GeneralRe: Another way for skinnable application Pin
The ~Coder12-Apr-03 12:49
sussThe ~Coder12-Apr-03 12:49 
GeneralRe: Another way for skinnable application Pin
CoolTool13-Apr-03 8:07
sussCoolTool13-Apr-03 8:07 
GeneralRe: Another way for skinnable application Pin
CoolTool13-Apr-03 8:07
sussCoolTool13-Apr-03 8:07 
GeneralRe: Another way for skinnable application Pin
The ~Coder13-Apr-03 8:26
sussThe ~Coder13-Apr-03 8:26 
GeneralVery good, but there's a bug Pin
Chris Miller23-Aug-02 20:35
memberChris Miller23-Aug-02 20:35 
Questionwhy no icon on task bar? Pin
Anonymous26-Feb-02 17:16
memberAnonymous26-Feb-02 17:16 
AnswerRe: why no icon on task bar? Pin
Galito13-Mar-02 17:46
memberGalito13-Mar-02 17:46 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171018.2 | Last Updated 18 Jul 2001
Article Copyright 2001 by John Roark
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid