读书人

关于ActiveSkin 的有关问题

发布时间: 2012-03-08 13:30:13 作者: rapoo

关于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);


}

void CSkin2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSkin2Dlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CSkin2Dlg, CDialog)
//{{AFX_MSG_MAP(CSkin2Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSkin2Dlg message handlers

BOOL CSkin2Dlg::OnInitDialog()
{
//CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}

}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE);// Set big icon
SetIcon(m_hIcon, FALSE);// Set small icon

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control
}

void CSkin2Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CSkin2Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CSkin2Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}


然后编译运行,出现10个错误

--------------------Configuration: skin2 - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
skin2Dlg.cpp
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(16) : error C2660: 'GetDlgItem' : function does not take 1 parameters
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(16) : error C2227: left of '->GetControlUnknown' must point to class/struct/union
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(17) : error C2143: syntax error : missing ';' before '->'
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(17) : error C2501: 'm_pSkin' : missing storage-class or type specifiers
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(17) : error C2371: 'm_pSkin' : redefinition; different basic types
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(16) : see declaration of 'm_pSkin'
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(17) : error C2143: syntax error : missing ';' before '->'


D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(18) : error C2143: syntax error : missing ';' before '->'
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(18) : error C2501: 'm_pSkin' : missing storage-class or type specifiers
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(18) : error C2371: 'm_pSkin' : redefinition; different basic types
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(16) : see declaration of 'm_pSkin'
D:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\Villean\skin2\skin2Dlg.cpp(18) : error C2143: syntax error : missing ';' before '->'
Generating Code...
Skipping... (no relevant changes detected)
skin2.cpp
Error executing cl.exe.

skin2.exe - 10 error(s), 0 warning(s)




求解~~~~我把CComQIPtr<ISkin> m_pSkin=GetDlgItem(IDC_SKIN)->GetControlUnknown();//m_pSkin是应用程序全局量。
m_pSkin->LoadSkin(L"BlackSea");//如果ActiveSkin控件中已有皮肤,此句可省略。
m_pSkin->ApplySkin((int)m_hWnd);
放在OnInitDialog函数中,虽然不报错了,但是界面没有替换~~
求高手解答啊~~~

[解决办法]
兄弟,发错版本了。发到VC去吧。
[解决办法]

探讨
兄弟,发错版本了。发到VC去吧。

[解决办法]
同意
探讨
引用:
兄弟,发错版本了。发到VC去吧。
同意.

读书人网 >PB

热点推荐