www.gusucode.com > VC++模仿超炫Vista风格QQ界面-源码程序 > VC++模仿超炫Vista风格QQ界面/BeautyQQ/BeautyQQ.cpp

    // BeautyQQ.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "BeautyQQ.h"
#include "BeautyQQDlg.h"

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


#include "ExtendClass\\BeautyTabCtrlEx.h"
#include "ExtendClass\\BeautyGroupCtrlEx.h"

//unicode version ....if other version... comment it
/**/
//
//make THCAR to char 
//
char* THCAR2char(TCHAR* tchStr) 
{ 

	int iLen = 2*wcslen(tchStr);//CString,TCHAR 
	char* chRtn = new char[iLen+1];
	wcstombs(chRtn,tchStr,iLen+1);
	return chRtn; 

} 

/////////////////////////////////////////////////////////////////////////////
// CBeautyQQApp

BEGIN_MESSAGE_MAP(CBeautyQQApp, CWinApp)
	//{{AFX_MSG_MAP(CBeautyQQApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBeautyQQApp construction

CBeautyQQApp::CBeautyQQApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CBeautyQQApp object

CBeautyQQApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CBeautyQQApp initialization

BOOL CBeautyQQApp::InitInstance()
{



	CString strPath;
	CString strFilename;
	strPath = GetModulePath();

	strFilename = strPath +_T("\\beautyQQ.bsk");
	SkinLoad(THCAR2char(strFilename.GetBuffer(0)));		

	SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, FALSE, NULL, 0);

	//重建非美化的控件类型表
	//build up the table by Ctrl-TYPE, that are not need to beautify
	//			int aUnSkinCtrlType[2] = { TYPE_BUTTON ,TYPE_DLG};
	//			int nUnSkinCtrlTypeNum = 2;
	//			BuildUnSkinCtrlType(nUnSkinCtrlTypeNum,aUnSkinCtrlType);
	
	//重建非美化的控件具体某一控件的ID表
	//build up the table by ID, that are not need to beautify
	//			DWORD aUnSkinCtrlID[2] = { IDC_BUTTON_USER_NAME,
	//									IDC_BUTTON_USER_NAME};
	//			int nUnSkinCtrlIDNum = 2;
	//			BuildUnSkinCtrlID(nUnSkinCtrlIDNum,aUnSkinCtrlID);
	
	//bind the ctrl to the specific-Ctrl-resource.
	BindRes2CtrlbyID(102,IDC_BUTTON_USER_NAME);	
	BindRes2CtrlbyID(107,IDC_BUTTON_TALK_FONT);
	BindRes2CtrlbyID(106,IDC_BUTTON_TALK_SERACH);
	BindRes2CtrlbyID(105,IDC_BUTTON_TALK_SM1);
	BindRes2CtrlbyID(105,IDC_BUTTON_TALK_SM2);
	
	CString szNormal, szOver, szDown;
	szNormal = strPath +"\\skin\\btn_normal.bmp";
	szOver   = strPath +"\\skin\\btn_over.bmp";
	szDown   = strPath +"\\skin\\btn_down.bmp";
	CBeautyGroupCtrlEx::LoadFace(szNormal.GetBuffer(0), szOver.GetBuffer(0), szDown.GetBuffer(0));
	
	szNormal = strPath +"\\skin\\tab_norm.bmp";
	szOver   = strPath +"\\skin\\tab_over.bmp";
	szDown   = strPath +"\\skin\\tab_sel.bmp";
	CBeautyTabCtrlEx::LoadTabBmps(szNormal.GetBuffer(0), szOver.GetBuffer(0), szDown.GetBuffer(0));
	

	AfxEnableControlContainer();

	CBeautyQQDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();

	SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, TRUE, NULL, 0);
			
	return FALSE;
}