当前位置: 代码迷 >> PB >> 关于ActiveSkin 的有关问题
  详细解决方案

关于ActiveSkin 的有关问题

热度:939   发布时间:2016-04-29 10:42:15
关于ActiveSkin 的问题
学习使用activeskin 遇到问题

第一步:在msdn下载的破解版跟vc安装在同一个文件夹后
随便建了个MFC对话框
按照百度的教程说的 先在在stdafx.h 添加#include <atlbase.h>
#import "actskn43.ocx" no_implementation raw_interfaces_only raw_native_types
using namespace ACTIVESKINLib;
这三行代码,完事后代码如下~(其他的都没修改)~~~


// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__A489C230_38C8_477A_9329_46AF22FC4655__INCLUDED_)
#define AFX_STDAFX_H__A489C230_38C8_477A_9329_46AF22FC4655__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <atlbase.h>
#import "actskn43.ocx" no_implementation raw_interfaces_only raw_native_types
using namespace ACTIVESKINLib;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__A489C230_38C8_477A_9329_46AF22FC4655__INCLUDED_)


第二部:在对话框的.cpp文件中以下加代码
CComQIPtr<ISkin> m_pSkin=GetDlgItem(IDC_SKIN)->GetControlUnknown();//m_pSkin是应用程序全局量。
m_pSkin->LoadSkin(L"BlackSea");//如果ActiveSkin控件中已有皮肤,此句可省略。
m_pSkin->ApplySkin((int)m_hWnd);


完事代码如下(其他的都没修改)


// skin2Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "skin2.h"
#include "skin2Dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
CComQIPtr<ISkin> m_pSkin=GetDlgItem(IDC_SKIN)->GetControlUnknown();//m_pSkin是应用程序全局量。
m_pSkin->LoadSkin(L"BlackSea");//如果ActiveSkin控件中已有皮肤,此句可省略。
m_pSkin->ApplySkin((int)m_hWnd);

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSkin2Dlg dialog

CSkin2Dlg::CSkin2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CSkin2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSkin2Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);