Click here to Skip to main content
15,891,423 members
Articles / Desktop Programming / MFC

A Picture Based Skin System and MPEG Decoder

Rate me:
Please Sign up or sign in to vote.
4.86/5 (25 votes)
27 Jul 2000 441.7K   13.9K   149   99
A picture based skin system for MFC that allows the user to customise their dialogs. The system is demonstrated by presenting a fully functioning MPEG decoder application.

Sample Image - skinsyse.jpg

SkinSys Ver 1.0

A picture based skin system For MFC. Based on FriendSoft's (www.yeah.net/FriendSoft) SkinForm.

SkinSys is copyright 2000 Cüneyt ELÝBOL (www.celibol.freeservers.com)

Includes

  • CSkinsys codes
  • Simple Skin Editor
  • A Beautiful MPEG 1,2,3 decoder (Copyright www.eldos.org - Based On MAPlay Decoder)
  • MPEGPlayer project (not completed. It is only a sample.)

Directories

  • Decoder: MPEG Decoder codes
  • Editor: Skineditor Files
  • Sample: Sample Skin Files
  • SkinSys: CSkinsys Source Code
  • Root: MPEGPlayer Project

Requirement

This system only requires the "OleLoadPicture" function. (Please see the LoadPictureFile function in Skindialog.cpp.)

How to Use

Please read these notes and see the Sample Directory and MPEGPlayer project:

  1. Draw mask bitmap
  2. Draw main Bitmap
  3. If you need or want
    1. Draw mouse over bitmap
    2. Draw mouse down bitmap
    3. Draw disable bitmap
  4. Run Skineditor
  5. Select "Screens" Tab
  6. Fill All Pictures
  7. If you want, select "Preview" Button
  8. Save and exit
  9. Run Visual Studio
  10. Create a Dialog based new Project (for example, Dialog Name = CBaseDialog)
  11. Include "SkinDialog.h" (for example, in "StdAfx.h")
  12. Change to CBaseDialog : public CDialog to CBaseDialog : public CSkinDialog
  13. Go to CBaseDialog::OnInitDialog and add these lines:
    C++
    char m_skin[512];
    sprintf(m_skin, "<Your Skin Name>");
    
    // If you want a menu < Activate to Right click > add this line
    SetMenuID(IDR_MAINMENU);
    
    // If you Want Caption 
    SetWindowText("MPEG Player");
    
    // Set To My SkinFile
    SetSkinFile(m_skin);
    
    CSkinDialog::OnInitDialog();
  14. Compile and run.

Controlling Buttons Click, Trackbar, ProgressBar, Text, etc.

If you want these events in the Base Class (CSkinDialog):

  1. void ProgresChanged(CString m_Name); // If progress changes
  2. void MouseMoved(CString m_ButtonName, int x, int y); // if Mouse Moved
  3. void TrackChange(CString m_ButtonName, UINT nSBCode, UINT nPos); // if Trackbar change
  4. void ButtonPressed(CString m_ButtonName); // if Button Pressed

you should add these functions to your CBaseDialog class.

Changing the Tooltip

use Set<xxx>ToolTip function. <xxx> is Button, Text...
For example:

C++
SetButtonToolTip("BUTTON_USEEQ", "Equalizer is On");

Getting Value

use Get<xxx> function
For example:

C++
BOOL useEQ = GetButtonCheck("BUTTON_USEEQ"); // if BUTTON_USEEQ checked

Setting Value

use Set<xxx> function
For example:

C++
SetButtonCheck("BUTTON_USEEQ", useEQ); // if useEQ = True BUTTON_USEEQ is checked

Notes

Thanks for your interest in CSkinsys. This is the first release, and may have bugs and errors. Please report any bugs or errors, or any questions to me.

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.


Written By
Turkey Turkey
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralModeless dialog not working Pin
Amit Walecha18-Aug-02 19:35
Amit Walecha18-Aug-02 19:35 
GeneralCompiler Error...Why Pin
jackqoo13-Aug-02 18:01
sussjackqoo13-Aug-02 18:01 
GeneralRe: Compiler Error...Why Pin
Gethsus16-Aug-02 5:31
Gethsus16-Aug-02 5:31 
GeneralIt's so confusing to understand this code...@,@ Pin
steadyrunner12-Aug-02 2:29
steadyrunner12-Aug-02 2:29 
GeneralBUG / Loss of memory Pin
22-Jul-02 6:37
suss22-Jul-02 6:37 
GeneralRe: BUG / Loss of memory Pin
pixelgrease8-Feb-03 8:21
pixelgrease8-Feb-03 8:21 
GeneralDialog skin Pin
chuchu19-Jul-02 15:17
chuchu19-Jul-02 15:17 
Generaltiny improvements Pin
Sibilant17-Jul-02 14:54
Sibilant17-Jul-02 14:54 
I just came back to this after a few months and got it to compile. I've made a few tiny improvements.

The controls flicker when a window goes over the dialog to I added
void CSkinDialog::PreSubclassWindow()
{
ModifyStyle( NULL , WS_CLIPCHILDREN ); // This is to REMOVE FLICKER
ModifyStyleEx( WS_EX_APPWINDOW, WS_EX_TOOLWINDOW ); // This is to remove the taskbar, but irrelevant for this message
CDialog::PreSubclassWindow();
}
in SkinDialog.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Then I removed the for-loops in SkinDialog.cpp OnPaint().
void CSkinDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here
RECT r;
GetClientRect(&r);
DrawBitmap(GetDC(), (HBITMAP) m_Normal, r, TRUE);
}
because it is no longer need and it just added flicker anyway, but if it wasn't there (before these changes) the controls wouldn't have been redrawn.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Then I modified CBitmapProgress::OnPaint() and added Keith Rule's CMemDC because the trackbars would flicker when you moved them alot.
Add memdc.h to your project. You can download it form here
http://www.codeproject.com/gdi/flickerfree.asp
#include "memdc.h" in BitmapProgress.h
Then change CBitmapProgress::OnPaint() to this.
void CBitmapProgress::OnPaint()
{
CPaintDC dc(this); // device context for painting

CRect r;
GetClientRect(&r);

CMemDC pDC(&dc,&r);

// TODO: Add your message handler code here
CDC memdc;
memdc.CreateCompatibleDC(NULL);
memdc.SelectObject(m_Normal);

pDC.BitBlt(0, 0, r.Width(), r.Height(), &memdc, 0, 0, SRCCOPY);
memdc.SelectObject(m_Down);
if(m_Horizantal)
{
int h = (r.Height() * m_Pos) / 100;
pDC.BitBlt(0, 0, r.Width(), h, &memdc, 0, 0, SRCCOPY);
}
else
{
int w = (r.Width() * m_Pos) / 100;
pDC.BitBlt(0, 0, w, r.Height(), &memdc, 0, 0, SRCCOPY);
}

// Do not call CBitmapBtn::OnPaint() for painting messages
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

and lastly make sure every GetDC is then released by using ReleaseDC as well as every CreateCompatibleDC is deleted by a DeleteDC.
I don't remember where I found them, but I found a few. In a graphics intensive program like this, it all adds up.
GeneralRe: tiny improvements Pin
Hae Moon, Kwon28-Jan-03 19:36
Hae Moon, Kwon28-Jan-03 19:36 
QuestionHow to insert bitmap in the dialogue application Pin
29-Jun-02 0:42
suss29-Jun-02 0:42 
QuestionMain window not in required shape ?? Pin
8-May-02 2:09
suss8-May-02 2:09 
AnswerRe: Main window not in required shape ?? Pin
Gethsus19-Aug-02 3:37
Gethsus19-Aug-02 3:37 
AnswerRe: Main window not in required shape ?? Pin
Paradoxx5-Jun-05 1:38
Paradoxx5-Jun-05 1:38 
QuestionHow to do data exchange? Pin
26-Feb-02 23:36
suss26-Feb-02 23:36 
GeneralSkin Programming Library (API) Pin
Jean-Marc Molina7-Feb-02 23:05
Jean-Marc Molina7-Feb-02 23:05 
GeneralCan't get it to compile Pin
Sibilant15-Jan-02 13:07
Sibilant15-Jan-02 13:07 
GeneralWeb interface for channels and playlists Pin
11-Dec-01 8:14
suss11-Dec-01 8:14 
GeneralJapy MP3 Player is based on SkinSys Pin
28-Nov-01 18:45
suss28-Nov-01 18:45 
GeneralRe: Japy MP3 Player is based on SkinSys Pin
16-Dec-01 9:56
suss16-Dec-01 9:56 
Generalvery good Pin
19-Nov-01 15:25
suss19-Nov-01 15:25 
GeneralCListCtrl can't work properly Pin
18-Nov-01 19:58
suss18-Nov-01 19:58 
GeneralSkin Pin
yoavadler12-Nov-01 21:15
yoavadler12-Nov-01 21:15 
GeneralRe: Skin Pin
Anonymous10-Oct-05 9:51
Anonymous10-Oct-05 9:51 
QuestionHow can I drag the dialog ? Pin
20-Oct-01 12:41
suss20-Oct-01 12:41 
AnswerRe: How can I drag the dialog ? Pin
Gethsus19-Aug-02 3:33
Gethsus19-Aug-02 3:33 

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.