MSI安装卸载日志源码公布MSIUI

MSI安装卸载日志源码公布

MSIUI


ColorStatic.cpp 文件内容

// This file was created on March 28th 2001 by Robert Brault.
// I created this Class to be able change the Color of your Static Text.
// This is Derived from CStatic.
//
// There are three functions available Currently:
// SetBkColor(COLORREF crColor)
// SetTextColor(COLORREF crColor)
//
// How To Use:
// Add three files to your project
// ColorStatic.cpp, ColorStatic.h and Color.h
// Color.h has (#define)'s for different colors (add any color you desire).
//
// Add #include "ColorStatic.h" to your Dialogs Header file.
// Declare an instance of CColorStatic for each static text being modified.
// Ex. CColorStatic m_stText;
//
// In your OnInitDialog() add a SubclassDlgItem for each CColorStatic member variable.
// Ex. m_stText.SubclassDlgItem(IDC_ST_TEXT, this);
// In this same function initialize your color for each piece of text unless you want the default.


// ColorStatic.cpp : implementation file
//

#include "stdafx.h"
#include "ColorStatic.h"

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

/
// CColorStatic

CColorStatic::CColorStatic()
{
	m_crBkColor = ::GetSysColor(COLOR_3DFACE); // Initializing the Background Color to the system face color.
	m_crTextColor = BLACK; // Initializing the text to Black
	m_brBkgnd.CreateSolidBrush(m_crBkColor); // Create the Brush Color for the Background.
}

CColorStatic::~CColorStatic()
{
}


BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
	//{{AFX_MSG_MAP(CColorStatic)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CColorStatic message handlers

HBRUSH CColorStatic::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	HBRUSH hbr;
	hbr = (HBRUSH)m_brBkgnd; // Passing a Handle to the Brush
	pDC->SetBkColor(m_crBkColor); // Setting the Color of the Text Background to the one passed by the Dialog
	pDC->SetTextColor(m_crTextColor); // Setting the Text Color to the one Passed by the Dialog

	if (nCtlColor)       // To get rid of compiler warning
      nCtlColor += 0;

	return hbr;
	
}

void CColorStatic::SetBkColor(COLORREF crColor)
{
	m_crBkColor = crColor; // Passing the value passed by the dialog to the member varaible for Backgound Color
	m_brBkgnd.DeleteObject(); // Deleting any Previous Brush Colors if any existed.
	m_brBkgnd.CreateSolidBrush(crColor); // Creating the Brush Color For the Static Text Background
	RedrawWindow();
}

void CColorStatic::SetTextColor(COLORREF crColor)
{
	m_crTextColor = crColor; // Passing the value passed by the dialog to the member varaible for Text Color
	RedrawWindow();
}

EnumProc.cpp 文件内容


// MSDN Magazine -- July 2002
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual Studio 6.0 and Visual Studio .NET
// Runs in Windows XP and probably Windows 2000 too.
//
#include "stdafx.h"
#include "EnumProc.h"
#include <Psapi.h>
#include <assert.h>

CWindowIterator::CWindowIterator(DWORD nAlloc)
{
	assert(nAlloc>0);
	m_current = m_count = 0;
	m_hwnds = new HWND [nAlloc];
	m_nAlloc = nAlloc;
}

CWindowIterator::~CWindowIterator()
{
	delete [] m_hwnds;
}

//
// Move to first top-level window.
// Stuff entire array and return the first HWND.
//
HWND CWindowIterator::First()
{
	::EnumWindows(EnumProc, (LPARAM)this);
	m_current = 0;
	return Next();
}

//
// Static enumerator passes to virtual fn.
//
BOOL CALLBACK CWindowIterator::EnumProc(HWND hwnd, LPARAM lp)
{
	return ((CWindowIterator*)lp)->OnEnumProc(hwnd);
}

//
// Virtual enumerator proc: add HWND to array if OnWindow is TRUE.
//
BOOL CWindowIterator::OnEnumProc(HWND hwnd)
{
	if (OnWindow(hwnd)) {
		if (m_count < m_nAlloc)
			m_hwnds[m_count++] = hwnd;
	}
	return TRUE; // keep looking
}

//
// Main window iterator: special case to iterate main windows of a process.
//
CMainWindowIterator::CMainWindowIterator(DWORD pid, DWORD nAlloc)
	: CWindowIterator(nAlloc)
{
	m_pid = pid;
}

CMainWindowIterator::~CMainWindowIterator()
{
}

//
// virtual override: is this window a main window of my process?
//
BOOL CMainWindowIterator::OnWindow(HWND hwnd)
{
	if (GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE) {
		DWORD pidwin;
		GetWindowThreadProcessId(hwnd, &pidwin);
		if (pidwin==m_pid)
			return TRUE;
	}
	return FALSE;
}

CProcessIterator::CProcessIterator()
{
	m_pids = NULL;
}

CProcessIterator::~CProcessIterator()
{
	delete [] m_pids;
}

//
// Get first process.
// Call EnumProcesses to initialize entire array, then return first one.
//
DWORD CProcessIterator::First()
{
	m_current = (DWORD)-1;
	m_count = 0;
	DWORD nalloc = 1024;
	do {
		delete [] m_pids;
		m_pids = new DWORD [nalloc];
		if (EnumProcesses(m_pids, nalloc*sizeof(DWORD), &m_count)) {
			m_count /= sizeof(DWORD);
			m_current = 1; // important: skip IDLE process with pid=0.
		}
	} while (nalloc <= m_count);

	return Next();
}

CProcessModuleIterator::CProcessModuleIterator(DWORD pid)
{
	// open the process
	m_hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
		FALSE, pid);
}

CProcessModuleIterator::~CProcessModuleIterator()
{
	CloseHandle(m_hProcess);
	delete [] m_hModules;
}

//
// Get first module in process. Call EnumProcesseModules to
// initialize entire array, then return first module.
//
HMODULE CProcessModuleIterator::First()
{
	m_count = 0;
	m_current = (DWORD)-1; 
	m_hModules = NULL;
	if (m_hProcess) {
		DWORD nalloc = 1024;
		do {
			delete [] m_hModules;
			m_hModules = new HMODULE [nalloc];
			if (EnumProcessModules(m_hProcess, m_hModules,
				nalloc*sizeof(DWORD), &m_count)) {
				m_count /= sizeof(HMODULE);
				m_current = 0;
			}
		} while (nalloc <= m_count);
	}
	return Next();
}

Function.cpp 文件内容

#include "StdAfx.h"
#define DLLINTERFACE __declspec(dllexport)
#include "Function.h"
#include "MSIProgressDlg.h"
#include "EnumProc.h"
#include "log.h"
#include "resource.h"

#define RES_CANCEL_ID 2

CMSIProgressDlg* pDlg=NULL;
CWnd parentWnd;
CWnd* pParentWnd = NULL;

int g_nNo = 0;
int g_nTotal = 0;
BOOL g_bIsRollBack = FALSE; //TRUE 回滚。。FALSE 不回滚。
BOOL g_bIsUninstall = FALSE;


void GetError(LPTSTR lpSource);

void CreateDlg()
{
	if(pDlg==NULL)
	{
		HWND hWnd = NULL;
		DWORD proId = GetCurrentProcessId();
		CMainWindowIterator mwit(proId);
		int count = mwit.GetCount();
		for(HWND mainHwnd=mwit.First(); mainHwnd; mainHwnd = mwit.Next())
		{
			if(IsWindowVisible(mainHwnd))
			{
				hWnd = mainHwnd;
				break;
			}
		}
		parentWnd.Attach(hWnd);
		pParentWnd = &parentWnd;
		ASSERT(pParentWnd);
		pDlg = new CMSIProgressDlg(pParentWnd);
		
		CString str;
		str.Format(_T("parent hwnd is %X"),hWnd);
		WriteLog(_T(""),str);
		
		if(pDlg->GetSafeHwnd() ==0)
		{  
			pDlg->Create(IDD_MAIN, pParentWnd);  
			CPoint point(0,0);
			CRect rect;
			pParentWnd->GetWindowRect(&rect);
			int y = rect.Height()/2;
			CRect rect2;
			pDlg->GetWindowRect(&rect2);
			CString offset;
			offset.LoadString(IDS_OFFSET);
			int width = _ttoi(offset);
			int x = rect.Width()-rect2.Width()-width;
			pDlg->SetWindowPos(NULL,x,y,0,0,SWP_NOSIZE|SWP_NOZORDER);
		}  
		pDlg->ShowWindow(SW_SHOW);
#ifndef _DEBUG
		CWnd* pbutton = pParentWnd->GetDlgItem(RES_CANCEL_ID);
		if( pbutton != NULL)
		{
			WriteLog(_T("pbutton is not null"),_T(""));
			CString str;
			str.Format(_T("pbutton hwnd is %X"),pbutton->GetSafeHwnd());
			WriteLog(_T(""),str);
			pbutton->EnableWindow(FALSE);
			pbutton->ShowWindow(SW_HIDE);
		}
#endif
	}
}

UINT _stdcall ShowDlg()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
#ifdef _DEBUG
	extern HWND g_hMain;
	SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETRANGE32,0,200);
	SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,190, 0);
#endif	
	return 0;	
}

UINT _stdcall Install(LPCTSTR fileName, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	WriteLog(_T(""), _T("Install() Enter!"));

	CreateDlg();
	g_bIsUninstall=FALSE;
	int nResult = pDlg->DoInstall(fileName, params, logfile,bIsShowNoBar);

	if( nResult!=0 && nResult!=3010 && nResult!=1602 && nResult!=1620 )
	{
		CString csMessage;
		switch(nResult)
		{
		case 2:
			csMessage.LoadString(IDS_err2);
			break;
		case 1601:
			csMessage.LoadString(IDS_err1601);
		case 1603:
			csMessage.LoadString(IDS_err1603);
			break;
		case 1618:
			csMessage.LoadString(IDS_err1618);
			break;
		case 1605:
			csMessage.LoadString(IDS_err1605);
			break;
		case 1619:
			csMessage.LoadString(IDS_err1619);
			break;
		case 112:
			csMessage.LoadString(IDS_err1620);
			break;
		case 2203: //杀毒软件存在。
			csMessage.LoadString(IDS_err1621);
			break;
		default:
			csMessage.Format(_T("Unkonwn Error:%d"), nResult);
			break;
		}
	    //如果是重试验按扭提示继续安装!
		if (::MessageBox(GetFocus(), csMessage,"Error", MB_RETRYCANCEL)==IDRETRY)
		{
			g_nNo--;
			nResult = Install(fileName, params, logfile,bIsShowNoBar);
		}
	
	}
	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Install result is "), str);
	WriteLog(_T(""), _T("Install() leave!"));
	return nResult;
}



UINT _stdcall Reinstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
	g_bIsUninstall=FALSE;
	int nResult = pDlg->DoReinstall(fileName, guid, params, logfile);
	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Reinstall result is "), str);
	return nResult;
}

	
UINT _stdcall Uninstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar,BOOL bIsRollBack)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
	//int nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar);
	g_bIsUninstall=TRUE;
	int nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar,bIsRollBack);

	if( nResult!=0 && nResult!=3010 && nResult!=1602 && nResult!=1620 && nResult!=1605 )
	{
		CString csMessage;
		switch(nResult)
		{
		case 2:
			csMessage.LoadString(IDS_err2);
			break;
		case 1601:
			csMessage.LoadString(IDS_err1601);
		case 1603:
			csMessage.LoadString(IDS_err1603);
			break;
		case 1618:
			csMessage.LoadString(IDS_err1618);
			break;
		case 1619:
			csMessage.LoadString(IDS_err1619);
			break;
		case 112:
			csMessage.LoadString(IDS_err1620);
			break;
		case 2203: //杀毒软件存在。
			csMessage.LoadString(IDS_err1621);
			break;
		default:
			csMessage.Format(_T("Unkonwn Error:%d"), nResult);
			break;
		}
	
		if (::MessageBox(GetFocus(), csMessage,"Error", MB_RETRYCANCEL)==IDRETRY)
		{
			g_nNo--;
			nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar,bIsRollBack);
		}
	
	}

	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Uninstall result is "), str);
	return nResult;
}

UINT _stdcall HideDlg()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
try{
	
	WriteLog(_T(""), _T("HideDlg() enter!"));
	if(pDlg != NULL)
	{
		if(pDlg->GetSafeHwnd() != 0)
		{
			if(pParentWnd != NULL && pParentWnd->GetSafeHwnd()!=0)
			{
				CWnd* pbutton = pParentWnd->GetDlgItem(RES_CANCEL_ID);
				if( pbutton != NULL)
				{
					WriteLog(_T("pbutton is not null"),_T(""));
					pbutton->ShowWindow(SW_SHOW);
					pbutton->EnableWindow(TRUE);
				}
				parentWnd.Detach();
				pParentWnd = NULL;
			}
			pDlg->ShowWindow(SW_HIDE);
			WriteLog(_T(""),_T("pDlg->ShowWindow(SW_HIDE);"));
			pDlg->DestroyWindow();
			WriteLog(_T(""),_T("pDlg->DestroyWindow();"));
		}
		WriteLog(_T(""),_T("delete pDlg;"));

		delete pDlg;
		pDlg = NULL;
		g_nNo = 0;
	}
	WriteLog(_T(""), _T("HideDlg() leave!"));
}
catch (...)
{
    GetError(_T("HideDlg exception"));
}

	return 0;
}

void _stdcall SetMsiCount(UINT nCount,BOOL bIsRollBack)
{
	CString num;
	num.Format(_T("%d"),nCount);
	WriteLog(_T("SetMsiCount"),num);
	g_bIsRollBack = bIsRollBack;
	g_nTotal = nCount;
}


BOOL _stdcall WriteU8SetupReg(int iValue)
{
	 char data_Set[1024]={"SOFTWARE\\Microsoft\\Windows"};
	 HKEY hKEY; 
	 DWORD type_1=REG_DWORD;
	 DWORD cbData_1=2;
	 DWORD newValue = iValue;
 
	 long ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_Set, 0, KEY_WRITE, &hKEY); 
	 if(ret==ERROR_SUCCESS) 
	 { 
		
		if( RegSetValueEx(hKEY,_T("u8setup"),NULL,type_1,(LPBYTE)&newValue,sizeof(newValue) ) ==  ERROR_SUCCESS) 
			return TRUE;
	 }
	 else
	 {
		 GetError(_T("RegOpenKeyEx"));
	 }
	 return FALSE;
}

void GetError(LPTSTR lpSource)
{
	LPVOID lpMsgBuf;
	if (!FormatMessage( 
		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
		FORMAT_MESSAGE_FROM_SYSTEM | 
		FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		GetLastError(),
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
		(LPTSTR) &lpMsgBuf,
		0,
		NULL ))
	{
		return;
	}
	
	WriteLog(lpSource,(LPTSTR)lpMsgBuf);
	//MessageBox(GetFocus(),(LPTSTR)lpMsgBuf,_T("错误"),0);

	LocalFree(lpMsgBuf);
}

Gradient.cpp 文件内容

#include "StdAfx.h"
#define DLLINTERFACE __declspec(dllexport)
#include "Function.h"
#include "MSIProgressDlg.h"
#include "EnumProc.h"
#include "log.h"
#include "resource.h"

#define RES_CANCEL_ID 2

CMSIProgressDlg* pDlg=NULL;
CWnd parentWnd;
CWnd* pParentWnd = NULL;

int g_nNo = 0;
int g_nTotal = 0;
BOOL g_bIsRollBack = FALSE; //TRUE 回滚。。FALSE 不回滚。
BOOL g_bIsUninstall = FALSE;


void GetError(LPTSTR lpSource);

void CreateDlg()
{
	if(pDlg==NULL)
	{
		HWND hWnd = NULL;
		DWORD proId = GetCurrentProcessId();
		CMainWindowIterator mwit(proId);
		int count = mwit.GetCount();
		for(HWND mainHwnd=mwit.First(); mainHwnd; mainHwnd = mwit.Next())
		{
			if(IsWindowVisible(mainHwnd))
			{
				hWnd = mainHwnd;
				break;
			}
		}
		parentWnd.Attach(hWnd);
		pParentWnd = &parentWnd;
		ASSERT(pParentWnd);
		pDlg = new CMSIProgressDlg(pParentWnd);
		
		CString str;
		str.Format(_T("parent hwnd is %X"),hWnd);
		WriteLog(_T(""),str);
		
		if(pDlg->GetSafeHwnd() ==0)
		{  
			pDlg->Create(IDD_MAIN, pParentWnd);  
			CPoint point(0,0);
			CRect rect;
			pParentWnd->GetWindowRect(&rect);
			int y = rect.Height()/2;
			CRect rect2;
			pDlg->GetWindowRect(&rect2);
			CString offset;
			offset.LoadString(IDS_OFFSET);
			int width = _ttoi(offset);
			int x = rect.Width()-rect2.Width()-width;
			pDlg->SetWindowPos(NULL,x,y,0,0,SWP_NOSIZE|SWP_NOZORDER);
		}  
		pDlg->ShowWindow(SW_SHOW);
#ifndef _DEBUG
		CWnd* pbutton = pParentWnd->GetDlgItem(RES_CANCEL_ID);
		if( pbutton != NULL)
		{
			WriteLog(_T("pbutton is not null"),_T(""));
			CString str;
			str.Format(_T("pbutton hwnd is %X"),pbutton->GetSafeHwnd());
			WriteLog(_T(""),str);
			pbutton->EnableWindow(FALSE);
			pbutton->ShowWindow(SW_HIDE);
		}
#endif
	}
}

UINT _stdcall ShowDlg()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
#ifdef _DEBUG
	extern HWND g_hMain;
	SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETRANGE32,0,200);
	SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,190, 0);
#endif	
	return 0;	
}

UINT _stdcall Install(LPCTSTR fileName, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	WriteLog(_T(""), _T("Install() Enter!"));

	CreateDlg();
	g_bIsUninstall=FALSE;
	int nResult = pDlg->DoInstall(fileName, params, logfile,bIsShowNoBar);

	if( nResult!=0 && nResult!=3010 && nResult!=1602 && nResult!=1620 )
	{
		CString csMessage;
		switch(nResult)
		{
		case 2:
			csMessage.LoadString(IDS_err2);
			break;
		case 1601:
			csMessage.LoadString(IDS_err1601);
		case 1603:
			csMessage.LoadString(IDS_err1603);
			break;
		case 1618:
			csMessage.LoadString(IDS_err1618);
			break;
		case 1605:
			csMessage.LoadString(IDS_err1605);
			break;
		case 1619:
			csMessage.LoadString(IDS_err1619);
			break;
		case 112:
			csMessage.LoadString(IDS_err1620);
			break;
		case 2203: //杀毒软件存在。
			csMessage.LoadString(IDS_err1621);
			break;
		default:
			csMessage.Format(_T("Unkonwn Error:%d"), nResult);
			break;
		}
	    //如果是重试验按扭提示继续安装!
		if (::MessageBox(GetFocus(), csMessage,"Error", MB_RETRYCANCEL)==IDRETRY)
		{
			g_nNo--;
			nResult = Install(fileName, params, logfile,bIsShowNoBar);
		}
	
	}
	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Install result is "), str);
	WriteLog(_T(""), _T("Install() leave!"));
	return nResult;
}



UINT _stdcall Reinstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
	g_bIsUninstall=FALSE;
	int nResult = pDlg->DoReinstall(fileName, guid, params, logfile);
	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Reinstall result is "), str);
	return nResult;
}

	
UINT _stdcall Uninstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar,BOOL bIsRollBack)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	CreateDlg();
	//int nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar);
	g_bIsUninstall=TRUE;
	int nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar,bIsRollBack);

	if( nResult!=0 && nResult!=3010 && nResult!=1602 && nResult!=1620 && nResult!=1605 )
	{
		CString csMessage;
		switch(nResult)
		{
		case 2:
			csMessage.LoadString(IDS_err2);
			break;
		case 1601:
			csMessage.LoadString(IDS_err1601);
		case 1603:
			csMessage.LoadString(IDS_err1603);
			break;
		case 1618:
			csMessage.LoadString(IDS_err1618);
			break;
		case 1619:
			csMessage.LoadString(IDS_err1619);
			break;
		case 112:
			csMessage.LoadString(IDS_err1620);
			break;
		case 2203: //杀毒软件存在。
			csMessage.LoadString(IDS_err1621);
			break;
		default:
			csMessage.Format(_T("Unkonwn Error:%d"), nResult);
			break;
		}
	
		if (::MessageBox(GetFocus(), csMessage,"Error", MB_RETRYCANCEL)==IDRETRY)
		{
			g_nNo--;
			nResult = pDlg->DoUninstall(fileName, guid, params, logfile,bIsShowNoBar,bIsRollBack);
		}
	
	}

	CString str;
	str.Format(_T("%d"), nResult);
	WriteLog(_T("Uninstall result is "), str);
	return nResult;
}

UINT _stdcall HideDlg()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
try{
	
	WriteLog(_T(""), _T("HideDlg() enter!"));
	if(pDlg != NULL)
	{
		if(pDlg->GetSafeHwnd() != 0)
		{
			if(pParentWnd != NULL && pParentWnd->GetSafeHwnd()!=0)
			{
				CWnd* pbutton = pParentWnd->GetDlgItem(RES_CANCEL_ID);
				if( pbutton != NULL)
				{
					WriteLog(_T("pbutton is not null"),_T(""));
					pbutton->ShowWindow(SW_SHOW);
					pbutton->EnableWindow(TRUE);
				}
				parentWnd.Detach();
				pParentWnd = NULL;
			}
			pDlg->ShowWindow(SW_HIDE);
			WriteLog(_T(""),_T("pDlg->ShowWindow(SW_HIDE);"));
			pDlg->DestroyWindow();
			WriteLog(_T(""),_T("pDlg->DestroyWindow();"));
		}
		WriteLog(_T(""),_T("delete pDlg;"));

		delete pDlg;
		pDlg = NULL;
		g_nNo = 0;
	}
	WriteLog(_T(""), _T("HideDlg() leave!"));
}
catch (...)
{
    GetError(_T("HideDlg exception"));
}

	return 0;
}

void _stdcall SetMsiCount(UINT nCount,BOOL bIsRollBack)
{
	CString num;
	num.Format(_T("%d"),nCount);
	WriteLog(_T("SetMsiCount"),num);
	g_bIsRollBack = bIsRollBack;
	g_nTotal = nCount;
}


BOOL _stdcall WriteU8SetupReg(int iValue)
{
	 char data_Set[1024]={"SOFTWARE\\Microsoft\\Windows"};
	 HKEY hKEY; 
	 DWORD type_1=REG_DWORD;
	 DWORD cbData_1=2;
	 DWORD newValue = iValue;
 
	 long ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_Set, 0, KEY_WRITE, &hKEY); 
	 if(ret==ERROR_SUCCESS) 
	 { 
		
		if( RegSetValueEx(hKEY,_T("u8setup"),NULL,type_1,(LPBYTE)&newValue,sizeof(newValue) ) ==  ERROR_SUCCESS) 
			return TRUE;
	 }
	 else
	 {
		 GetError(_T("RegOpenKeyEx"));
	 }
	 return FALSE;
}

void GetError(LPTSTR lpSource)
{
	LPVOID lpMsgBuf;
	if (!FormatMessage( 
		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
		FORMAT_MESSAGE_FROM_SYSTEM | 
		FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		GetLastError(),
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
		(LPTSTR) &lpMsgBuf,
		0,
		NULL ))
	{
		return;
	}
	
	WriteLog(lpSource,(LPTSTR)lpMsgBuf);
	//MessageBox(GetFocus(),(LPTSTR)lpMsgBuf,_T("错误"),0);

	LocalFree(lpMsgBuf);
}

\log.cpp文件内容

#include "StdAfx.h"
#include "log.h"


#define MAX_LENGTH 4096
#define LOGFILENAME _T("\\U8SetupError.log")

int WriteText(LPCTSTR lpSrc,LPCTSTR lpMsg)
{
//	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CStdioFile inputFile;
	TCHAR lpFile[MAX_PATH];
	ZeroMemory(lpFile,sizeof(lpFile));

	GetSystemDirectory(lpFile, MAX_PATH);
	_tcscat(lpFile, LOGFILENAME);

	TCHAR lpMutexName[] = _T("U8SETUPERRLOG");
	HANDLE hMutex;
	try
	{
		hMutex = OpenMutex(MUTEX_ALL_ACCESS,FALSE,lpMutexName);
		if(!hMutex)
		{
			hMutex = CreateMutex(NULL,FALSE,lpMutexName);
		}
		
		if(!hMutex)
			return 0;
		WaitForSingleObject(hMutex,INFINITE);
		inputFile.Open(lpFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite);		
		inputFile.SeekToEnd();
		
		COleDateTime time;
		 time = COleDateTime::GetCurrentTime();
		CString sMsg = time.Format(_T("[%Y-%m-%d %H:%M:%S]"));
		TCHAR* lpSource = new TCHAR[MAX_LENGTH];
		ZeroMemory(lpSource,MAX_LENGTH);
		_tcscpy(lpSource,lpSrc);
		_tcscat(lpSource,_T(":"));
		_tcscat(lpSource,lpMsg);
		_tcscat(lpSource,_T("\n"));
		sMsg.Insert(sMsg.GetLength(),lpSource);
		inputFile.WriteString(sMsg);
		inputFile.Close();
		delete[] lpSource;
	}
	catch(...)
	{
	}
	ReleaseMutex(hMutex);
	return 0;
}

void _stdcall WriteLog(LPCTSTR lpSource,LPCTSTR lpMsg)
{
//	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	DWORD tid = GetCurrentThreadId();
	CString cstr;
	cstr.Format(_T("%s[%d] %s"),_T("Thread"),tid,lpSource);
	LPTSTR lpsz = new TCHAR[cstr.GetLength()+1];
	ZeroMemory(lpsz,cstr.GetLength()+1);
	_tcscpy(lpsz,cstr);
	WriteText(lpsz,lpMsg);
	delete[] lpsz;
}


.\MSIProgressDlg.cpp 文件内容

// MSIProgressDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MSIUI.h"
#include "MSIProgressDlg.h"
#include "log.h"
#define DLLINTERFACE __declspec(dllexport)
#include "Function.h"

#ifdef _DEBUG
#include <fstream>
using namespace std;
ofstream logf("c:\\trace.log");
#endif

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

HINSTANCE g_hInstance = NULL;
HICON     g_hIcon = NULL;
HWND	  g_hMain = NULL;

BOOL volatile g_bCancelInstall = FALSE;
extern BOOL g_bIsUninstall;
extern BOOL g_bIsRollBack;
int g_rgiField[3]; //array of fields to handle INSTALLOGMODE_COMMONDATA data
WORD g_wLANGID = LANG_NEUTRAL; // initialize to neutral language
//    progress information fields
int iField[4]; //array of record fields to handle INSTALLOGMODE_PROGRESS data
int  g_iProgressTotal = 0; //总的进度条的长度 total ticks on progress bar
int  g_iProgress = 0;      // 当前进度条的长度 amount of progress
BOOL g_bForwardProgress = TRUE; //TRUE 进度条向后推进,FALSE 相反 if the progress bar control should be incremented in a forward direction 
BOOL g_bEnableActionData; //TRUE if INSTALLOGMODE_ACTIONDATA messages are sending progress information
int  g_iOffset = 0;

bool g_bInstallValidate = false;
bool g_bInstallFinalize = false;
bool g_bRollbackCleanup = false;
int  m_isunistallstart=2;
int FGetInteger(char*& rpch)
{
    char* pchPrev = rpch; 
    while (*rpch && *rpch != ' ')
        rpch++;
    *rpch = '\0';
    int i = atoi(pchPrev);
    return i;
}


BOOL ParseCommonDataString(LPSTR sz)
{
    char *pch = sz;
    if (0 == *pch)
        return FALSE; // no msg

    while (*pch != 0)
    {
        char chField = *pch++;
        pch++; // for ':'
        pch++; // for sp
        switch (chField)
        {
        case '1': // field 1
            {
                // common data message type
                g_rgiField[0] = *pch++ - '0';
                if (g_rgiField[0] == 1)
                    return FALSE; // we are ignoring caption messages
                break;
            }
        case '2': // field 2
            {
                // because we are ignoring caption msg, these are all ints
                g_rgiField[1] = FGetInteger(pch);
                return TRUE; // done processing
            }
        default: // unknown field
            {
                return FALSE;
            }
        }
        pch++; // for space (' ') between fields
    }
    
    return TRUE;
}


//
//  FUNCTION: ParseProgressString(LPSTR sz)
//
//  PURPOSE:  Parses the progress data message sent to the INSTALLUI_HANDLER callback
//
//  COMMENTS: Assumes correct syntax.
//
BOOL ParseProgressString(LPSTR sz)
{
    char *pch = sz;
    if (0 == *pch)
        return FALSE; // no msg

    while (*pch != 0)
    {
        char chField = *pch++;
        pch++; // for ':'
        pch++; // for sp
        switch (chField)
        {
        case '1': // field 1
            {
                // progress message type
                if (0 == isdigit(*pch))
                    return FALSE; // blank record
                iField[0] = *pch++ - '0';
                break;
            }
        case '2': // field 2
            {
                iField[1] = FGetInteger(pch);
                if (iField[0] == 2 || iField[0] == 3)
                    return TRUE; // done processing
                break;
            }
        case '3': // field 3
            {
                iField[2] = FGetInteger(pch);
                if (iField[0] == 1)
                    return TRUE; // done processing
                break;
            }
        case '4': // field 4
            {
                iField[3] = FGetInteger(pch);
                return TRUE; // done processing
            }
        default: // unknown field
            {
                return FALSE;
            }
        }
        pch++; // for space (' ') between fields
    }
    
    return TRUE;
}


int _stdcall MsiUIHandler(LPVOID pvContext, UINT iMessageType, LPCSTR szMessage)
{
    
	static bool s_bIsSetText = false;

	int nret = 0;
	INSTALLMESSAGE mt;
    UINT uiFlags;
	CString lang;
    lang.LoadString(IDS_LANG);
	CString strMessage;

    mt = (INSTALLMESSAGE)(0xFF000000&(UINT)iMessageType);
    uiFlags = 0x00FFFFFF&iMessageType;

	int tempPos;

    switch (mt)
    {
    case INSTALLMESSAGE_FATALEXIT:
           return MessageBox(0, szMessage, TEXT("FatalError"), uiFlags);

    case INSTALLMESSAGE_ERROR:
        {
            MessageBeep(uiFlags & MB_ICONMASK);
            return MessageBoxEx(0, szMessage, TEXT("Error"), uiFlags, g_wLANGID);     
        }        
    case INSTALLMESSAGE_WARNING:
           return MessageBox(0, szMessage, TEXT("Warning"), uiFlags);

    case INSTALLMESSAGE_USER:
        return IDOK;    
    
    case INSTALLMESSAGE_INFO:
        return IDOK;

    case INSTALLMESSAGE_FILESINUSE:
        return 0;

    case INSTALLMESSAGE_RESOLVESOURCE:
        return 0;

    case INSTALLMESSAGE_OUTOFDISKSPACE:
        return IDOK;
    
    case INSTALLMESSAGE_ACTIONSTART:
		{
 			CString str(szMessage);
			if(str.Find(_T("InstallValidate")) != -1)
			{
				g_bInstallValidate = true;
			}
			else if (str.Find(_T("InstallFinalize")) != -1)
			{
				g_bInstallFinalize = true;
			}
			else if (str.Find(_T("RollbackCleanup")) != -1)
			{
				g_bRollbackCleanup = true;
			}
#ifdef _DEBUG
			logf <<szMessage <<endl;
#endif
// 			int n = str.ReverseFind(_T('.'));
// 			CString msg = str.Mid(n+1,str.GetLength()-n-1);
// 			if(msg != "" && msg != " ")
// 			{
// 				SetDlgItemText(g_hMain, IDC_SUBTOTAL, msg);
// 			}
		
		}
        return IDOK;
    
    case INSTALLMESSAGE_ACTIONDATA:
		{	 
			if (0 == g_iProgressTotal)
				return IDOK;
			
			if(lang == _T("CN"))
			{
				SetDlgItemText(g_hMain, IDC_DESCR, szMessage);
			}
			else
			{
				if(s_bIsSetText == false)
				{
					CString str;
					str.LoadString(IDS_INSTALLING);
					SetDlgItemText( g_hMain, IDC_DESCR, str);
					s_bIsSetText = true;
				}
			}
			
			
			if(g_bEnableActionData)
			{
				SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_STEPIT,0,0);
#ifdef _DEBUG
				logf<<"stepit"<<endl;
#endif
			}
			return IDOK;
		}
    case INSTALLMESSAGE_PROGRESS:
        {
#ifdef _DEBUG
			logf<<szMessage<<endl;
#endif
			if(ParseProgressString(const_cast<LPSTR>(szMessage)))
            {
                switch(iField[0])
                {
                case 0:
                    {
                        if (iField[2] == 0)
						{   
							if(g_bIsUninstall==TRUE) //如果是卸载。。
							{
							   if(g_bIsRollBack==TRUE) //回滚状态。。
							   {
                                 g_bForwardProgress = FALSE;  //TRUE 进度条向后推进,FALSE 相反
							   }
							   else
							   {
							    g_bForwardProgress = TRUE;  //TRUE 进度条向后推进,FALSE 相反
							   }
							   if(m_isunistallstart>1)
							   {
								 m_isunistallstart=m_isunistallstart-1;
								 tempPos=iField[1]*10;
                                 SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,tempPos, 0);
							   }
							   //g_bRollbackCleanup=TRUE;
							}
							else 
							{
								if(g_bIsRollBack==TRUE) //回滚状态。。
								{
                                  g_bForwardProgress = FALSE;
								}
								else
								{
                                  g_bForwardProgress = TRUE;
								}
							   if(m_isunistallstart>1)
							   {
								 m_isunistallstart=m_isunistallstart-1;
							     tempPos=0;
								 SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,tempPos, 0);  //设置进度条的状态为开始状态.
							   }
							   
							}
						}
                        else
						{
                            g_bForwardProgress = FALSE;
							//lilf 2012-1-21设置安装状态为回滚。。
                            g_bRollbackCleanup=TRUE;
							if(g_bIsUninstall==TRUE)
							{
							  tempPos=iField[1]*10;
                              SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,tempPos, 0);
							}
						}

						if(iField[1] == 0)
						{	break; }
						g_iProgressTotal = iField[1];

						if( g_bInstallValidate&&g_bIsUninstall==FALSE)
						{
							g_iProgressTotal *= 10;
							g_bInstallValidate = false;
	 						tempPos = 0;
						}
						else if(g_bInstallFinalize&&g_bIsUninstall==FALSE)
						{
							g_iProgressTotal = g_iProgressTotal/4*5;
							g_bInstallFinalize = false;
							tempPos = g_iProgressTotal/10;
						}
						else if(g_bRollbackCleanup)
						{
							if(g_bIsUninstall==FALSE)
							{
						    	g_iProgressTotal *= 10;
							    g_bRollbackCleanup = false;
							    tempPos = g_iProgressTotal*9/10;
							    SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETSTEP,1,0);
							}
							else
							{
						    	g_iProgressTotal = g_iProgressTotal*10;
							    g_bRollbackCleanup = false;
							    tempPos = g_iProgressTotal/10;
							    SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETSTEP,1,0);
							}
						}
						TRACE1("g_iProgressTotal is %d \n", g_iProgressTotal);
                        g_iProgress = g_bForwardProgress ? 0 : g_iProgressTotal;
                        SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETRANGE32,0,g_iProgressTotal);
						SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,tempPos, 0);

                        break;
                    }
                case 1:
                    {
                        if(iField[2])
                        {
							if(m_isunistallstart>0)  //第一次删除文件的时候设置回滚为最大状态。
							{
								 m_isunistallstart=m_isunistallstart-1;
								 SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,g_iProgressTotal, 0);
								 
							}
							else
							{
                                SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETSTEP,g_bForwardProgress ? iField[1] : -1*iField[1],0);
                                g_bEnableActionData = TRUE;
							}
                        }
                        else
                        {
                            g_bEnableActionData = FALSE;
                        }
                        break;
                    }
                case 2:
                    {
                        if (0 == g_iProgressTotal)
						{
                            break;
						}
                        SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_DELTAPOS,g_bForwardProgress ? iField[1] : -1*iField[1],0);
                        break;
                    }
                case 3: 
                default:
                    {
                        break;
                    }
                }
            }
            if(g_bCancelInstall == TRUE)
            {
				g_bCancelInstall = FALSE;
                return IDCANCEL;
            }
            else
			{
                return IDOK;
			}
        }

    case INSTALLMESSAGE_COMMONDATA:
        {
            if (ParseCommonDataString(const_cast<LPSTR>(szMessage)))
            {
                switch (g_rgiField[0])
                {
                case 0:
                    g_wLANGID = g_rgiField[1];
                    break;
                case 1:
                    break;
                case 2:
                    ShowWindow(GetDlgItem(g_hMain, IDC_CANCEL), g_rgiField[1] == 0 ? SW_HIDE : SW_SHOW);
                    break;
                default:
                    break;
                }
            }
            return IDOK;
        }

    case INSTALLMESSAGE_INITIALIZE:
	   if(g_bIsUninstall==TRUE)
		{
           g_bForwardProgress = TRUE;
		   m_isunistallstart=2;
		   //lilf 2012-1-21设置安装状态为回滚。。
           // g_bRollbackCleanup=TRUE;
		}
		else
		{
		  ::SendMessage(::GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETBARCOLOR, 0, ::GetSysColor(COLOR_HIGHLIGHT));
		  g_iProgressTotal = 0;
		  g_iProgress = 0;
		  g_bForwardProgress = TRUE;
		  g_iOffset = 0;
		  g_bInstallValidate = false;
		  g_bInstallFinalize = false;
		  g_bRollbackCleanup = false;
		  s_bIsSetText = false;
		}
        return IDOK;

    case INSTALLMESSAGE_TERMINATE:
		EnableWindow(GetDlgItem(g_hMain, IDC_CANCEL),FALSE);
		if(g_bForwardProgress==TRUE)
		{
		   SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,g_iProgressTotal, 0);
		}
		else if(g_bForwardProgress==FALSE)
		{
           SendMessage(GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,0, 0);
		}
        return IDOK;
    
    case INSTALLMESSAGE_SHOWDIALOG:
        return IDOK;
		
    default:
        return 0;
    }
	return nret;
}

/
// CMSIProgressDlg dialog


CMSIProgressDlg::CMSIProgressDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMSIProgressDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMSIProgressDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CMSIProgressDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMSIProgressDlg)
	DDX_Control(pDX, IDC_PRGSUB, m_ProgressBar);
	DDX_Control(pDX, IDC_DESCR, m_Description);
	DDX_Control(pDX, IDC_NUMBER, m_TotalTitle);
	DDX_Control(pDX, IDC_MSINAME, m_MsiTitle);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMSIProgressDlg, CDialog)
	//{{AFX_MSG_MAP(CMSIProgressDlg)
	ON_WM_CREATE()
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_CANCEL, OnCancel)
	ON_WM_CLOSE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CMSIProgressDlg message handlers

BOOL CMSIProgressDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	/*
	m_DlgColor.CreateSolidBrush(RGB(0x3E,0x66,0xAB));
	m_MsiTitle.SetBkColor(RGB(0x3E,0x66,0xAB));
	m_MsiTitle.SetTextColor(WHITE);
	m_TotalTitle.SetBkColor(RGB(0x3E,0x66,0xAB));
	m_TotalTitle.SetTextColor(WHITE);
	m_Description.SetBkColor(RGB(0x3E,0x66,0xAB));
	m_Description.SetTextColor(WHITE);
	*/
	#define BACKGROUD_WHITE   RGB( 250, 249,249)
	m_DlgColor.CreateSolidBrush(BACKGROUD_WHITE);
	m_MsiTitle.SetBkColor(BACKGROUD_WHITE);
	m_MsiTitle.SetTextColor(BLACK);
	m_TotalTitle.SetBkColor(BACKGROUD_WHITE);
	m_TotalTitle.SetTextColor(BLACK);
	m_Description.SetBkColor(BACKGROUD_WHITE);
	m_Description.SetTextColor(BLACK);
	


	MsiSetInternalUI(INSTALLUILEVEL(INSTALLUILEVEL_NONE|INSTALLUILEVEL_SOURCERESONLY), NULL);
	
	MsiSetExternalUI (MsiUIHandler,
		INSTALLLOGMODE_PROGRESS|INSTALLLOGMODE_FATALEXIT|INSTALLLOGMODE_ERROR
		|INSTALLLOGMODE_WARNING|INSTALLLOGMODE_USER|INSTALLLOGMODE_INFO
		|INSTALLLOGMODE_RESOLVESOURCE|INSTALLLOGMODE_OUTOFDISKSPACE
		|INSTALLLOGMODE_ACTIONSTART|INSTALLLOGMODE_ACTIONDATA
		|INSTALLLOGMODE_COMMONDATA|INSTALLLOGMODE_PROGRESS|INSTALLLOGMODE_INITIALIZE
		|INSTALLLOGMODE_TERMINATE|INSTALLLOGMODE_SHOWDIALOG, 
		NULL);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

extern int g_nNo;
extern int g_nTotal;
extern BOOL g_bIsRollBack;



UINT CMSIProgressDlg::DoInstall(const CString& fileName, const CString& params, const CString& logfile,BOOL bIsShowNoBar)
{
	::EnableWindow(::GetDlgItem(g_hMain, IDC_CANCEL),TRUE);
	
	CString str;
	str.LoadString(IDS_INITIATION);
	::SetDlgItemText( g_hMain, IDC_DESCR, str);
	
	
	CString file(fileName);
	int n = file.ReverseFind(_T('\\'));
	int m = file.ReverseFind(_T('.'));
	CString name = file.Mid(n+1, m-n-1);
	name.MakeUpper();
	m_MsiTitle.SetWindowText(name);


	if(bIsShowNoBar == TRUE)
	{
		SetTotalTitle();
	}
	else
	{
		m_TotalTitle.SetWindowText("");
	}
	
	SetLog(logfile);
	
	return MsiInstallProduct(fileName, params);	
}

UINT CMSIProgressDlg::DoUninstall(const CString& fileName, const CString& proCode, const CString& params, const CString& logfile,BOOL bIsShowNoBar,BOOL bIsRollBack)
{
	SetMsiTitle(fileName);
	//卸载如果是回滚设置回滚状态为TRUE 。如果不是设置为FALSE
	if(bIsRollBack==TRUE)
	{
	   g_bIsRollBack=TRUE;
	}
	else
	{
	   g_bIsRollBack=FALSE;
	}
	if(bIsShowNoBar == TRUE)
	{
		SetTotalTitle();
	}
	else
	{
		m_TotalTitle.SetWindowText("");
	}
	SetLog(logfile);
	return	MsiConfigureProductEx(proCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT, params);
}

UINT CMSIProgressDlg::DoReinstall(const CString& fileName, const CString& proCode, const CString& params, const CString& logfile)
{
	SetMsiTitle(fileName);
	SetTotalTitle();
	SetLog(logfile);
	return	MsiConfigureProductEx(proCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_LOCAL, params);
}
//设置包的个数。。
void CMSIProgressDlg::SetTotalTitle()
{
	int m_currentnumber=0; //每次安装累加的包的个数
	int m_currentcountall=0; //总的包的个数
	if(!g_bIsRollBack) //不是回滚,安装包的个数添加
	{
		m_currentnumber=++g_nNo;
		m_currentcountall=g_nTotal;
		if(g_bIsUninstall==FALSE)
		{
			if(m_currentnumber>m_currentcountall) //如果实际大于总的包的个数,已实际的为准。
			{
				m_currentcountall=m_currentnumber;
			}
		}
	}
	CString totalStr;

	if(!g_bIsRollBack)
	{
		//卸载的时候
		int m_processpercent=(m_currentnumber*100)/m_currentcountall;
		if(m_processpercent>101)
		{
		   m_processpercent=100;
		}
		totalStr.Format(_T("%d%%"),m_processpercent);
	}
	else
	{
		//回滚的时候
		int m_percentrollback=0;
		if(g_nNo>0)
		{
		    m_percentrollback=(g_nNo*100)/g_nTotal;
			if(m_percentrollback>101)
			{
				m_percentrollback=100;
			}
		}
		if(g_nNo<=0)
		{
		   m_percentrollback=0;
		}
		totalStr.Format(_T("%d%%"),--g_nNo, g_nTotal);
	}
    if(g_bIsUninstall==FALSE)
	{
    	m_TotalTitle.SetWindowText(totalStr);
	}
}

void CMSIProgressDlg::SetMsiTitle(const CString& fileName)
{
	::EnableWindow(::GetDlgItem(g_hMain, IDC_CANCEL),FALSE);
	CString name(fileName);
	name = name.Left(name.GetLength()-4);
	name.MakeUpper();
	m_MsiTitle.SetWindowText(name);
	::SendMessage(::GetDlgItem(g_hMain, IDC_PRGSUB),PBM_SETPOS,0, 0);
}

void CMSIProgressDlg::SetLog(const CString& logfile)
{
	if(!logfile.IsEmpty())
	{
		MsiEnableLog(INSTALLLOGMODE_VERBOSE | INSTALLLOGMODE_FATALEXIT |
		INSTALLLOGMODE_ERROR | INSTALLLOGMODE_WARNING | INSTALLLOGMODE_USER |
		INSTALLLOGMODE_INFO | INSTALLLOGMODE_RESOLVESOURCE | INSTALLLOGMODE_OUTOFDISKSPACE |
		INSTALLLOGMODE_ACTIONSTART | INSTALLLOGMODE_ACTIONDATA | INSTALLLOGMODE_COMMONDATA |
		INSTALLLOGMODE_PROPERTYDUMP /*| INSTALLLOGMODE_EXTRADEBUG*/, logfile, NULL);
	}
}

int CMSIProgressDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if(GetSafeHwnd() !=0)  
	{
		g_hMain = m_hWnd;
	}

	return 0;
}

void CMSIProgressDlg::OnCancel() 
{
	CString msg;
	CString title;
	msg.LoadString(IDS_CANCEL);
	title.LoadString(IDS_SETUP);
	if( MessageBox(msg,title, MB_YESNO) == IDYES)
	{
		g_bCancelInstall = TRUE;
	}
}

void CMSIProgressDlg::SetTitleMsg(const CString& msg)
{
	
}

void CMSIProgressDlg::SetDescMsg(const CString& msg)
{
	
}

HBRUSH CMSIProgressDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	if(nCtlColor == CTLCOLOR_DLG || CTLCOLOR_BTN == nCtlColor || CTLCOLOR_STATIC == nCtlColor)
	{
		return m_DlgColor;
	}
	
	return hbr;
}

void CMSIProgressDlg::PostNcDestroy() 
{
//	HideDlg();
	WriteLog(_T(""),_T("CMSIProgressDlg::PostNcDestroy()"));
	CDialog::PostNcDestroy();
}

void CMSIProgressDlg::OnDestroy() 
{
	CDialog::OnDestroy();
	WriteLog(_T(""),_T("CMSIProgressDlg::OnDestroy()"));
}
.\MSIUI.cpp 文件内容

// MSIUI.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "MSIUI.h"

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

//
//	Note!
//
//		If this DLL is dynamically linked against the MFC
//		DLLs, any functions exported from this DLL which
//		call into MFC must have the AFX_MANAGE_STATE macro
//		added at the very beginning of the function.
//
//		For example:
//
//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
//		{
//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
//			// normal function body here
//		}
//
//		It is very important that this macro appear in each
//		function, prior to any calls into MFC.  This means that
//		it must appear as the first statement within the 
//		function, even before any object variable declarations
//		as their constructors may generate calls into the MFC
//		DLL.
//
//		Please see MFC Technical Notes 33 and 58 for additional
//		details.
//

/
// CMSIUIApp

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

/
// CMSIUIApp construction

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

/
// The one and only CMSIUIApp object

CMSIUIApp theApp;

.\MSIUI.def 文件内容

; MSIUI.def : Declares the module parameters for the DLL.

LIBRARY      "MSIUI"
DESCRIPTION  'MSIUI Windows Dynamic Link Library'

EXPORTS
    ; Explicit exports can go here
	ShowDlg @1
	Install @2
	Uninstall @3
	Reinstall @4	
	HideDlg @5
	SetMsiCount @6
	WriteU8SetupReg @7
	


.\Progress.cpp 文件内容

///
// class CProgress
//
// Author:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
// Copyright ?2000, Yury Goltsman
//
// This code provided "AS IS," without warranty of any kind.
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// version : 1.4
// Gradient Animation added
//
// version : 1.3
// Separated to window independent classes CProgress and CGradient (base)
// Added palette support for 256 colors mode (to CGradient)
// Added shaped style drawing 
//
//
// Old history of CProgressCtrlX:
//
// version : 1.2
// Added support for "Any angle text rotation" 
//   (define PBT_ANY_ANGLE and set font with appropriated angle)
// Added text alignment
// Added possibility to format text (via virtual function FormatText())
//   e.g. you can show percent as decimal fraction instead of integer
//
// version : 1.1
// Added multi-color gradient
// Added filling with brush for background and bar(overrides color settings)
// Added borders attribute
// Added vertical text support
// Added snake mode
// Added reverse mode
// Added dual color for text
// Added text formatting
// Added tied mode for text and rubber bar mode
// Added support for vertical oriented control(PBS_VERTICAL)
// 
// version : 1.0
//

#include "stdafx.h"
#include "Progress.h"

#include "MemDC.h"
#include "DrawGdiX.h"
#include "resource.h"

#ifdef PBT_ANY_ANGLE
	#include <math.h>
#endif

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

/
// CProgress

CProgress::CProgress()
	: m_rcBorders(0,0,0,0)
{
	// Init colors
	m_clrBk = ::GetSysColor(COLOR_3DFACE);
	m_clrTextOnBar = ::GetSysColor(COLOR_CAPTIONTEXT);
	m_clrTextOnBk = ::GetSysColor(COLOR_BTNTEXT);
	
	// set gradient colors
	COLORREF clrStart, clrEnd;
	clrStart = clrEnd = ::GetSysColor(COLOR_HIGHLIGHT);
/*
#if(WINVER >= 0x0500)
	BOOL fGradientCaption = FALSE;
	if(SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &fGradientCaption, 0) &&
	   fGradientCaption)
		clrEnd = ::GetSysColor(COLOR_GRADIENTACTIVECAPTION);
#endif 
*/
	SetGradientColors(clrStart, clrEnd);
	m_pbrBk = m_pbrBar = NULL;

	m_nStep = 10;
	m_nTail = 0;
	m_nTailSize = 40;
	m_nLower = 0;
	m_nUpper = 100;
	m_nPos = 0;
	m_nAnimPos = 0;

	m_pFont = NULL;
	m_dwStyle = PBS_CENTER|PBS_VCENTER;
}

void CProgress::Draw(CDC* pDC, CRect rcDraw, BOOL fSkipDCCache) 
{
	if(m_rgnShape.GetSafeHandle())
	{
		pDC->SelectClipRgn(&m_rgnShape);
		pDC->OffsetClipRgn(rcDraw.left, rcDraw.top);
	}
	
	CDrawInfo info;
	info.rcClient = rcDraw;

	// retrieve current position and range
	info.nCurPos = GetPos();
	GetRange(info.nLower, info.nUpper);
	
	// Draw to memory DC
	BOOL fPrinting = pDC->m_bPrinting;
	if(fSkipDCCache) pDC->m_bPrinting = TRUE; // CMemDC will skip caching
	CMemDC memDC(pDC, rcDraw, !m_pbrBk && m_clrBk == CLR_NONE);
	pDC->m_bPrinting = fPrinting;
	info.pDC = &memDC;

	// fill background 
	if(m_pbrBk)
		info.pDC->FillRect(&info.rcClient, m_pbrBk);
	else if(m_clrBk != CLR_NONE)
		info.pDC->FillSolidRect(&info.rcClient, m_clrBk);

	// apply borders
	info.rcClient.DeflateRect(m_rcBorders);
		
	// if current pos is out of range return
	if (info.nCurPos < info.nLower || info.nCurPos > info.nUpper)
		return;

	info.dwStyle = GetBarStyle();
	BOOL fVert = info.dwStyle&PBS_VERTICAL;
	BOOL fSnake = info.dwStyle&PBS_SNAKE;
	BOOL fRubberBar = info.dwStyle&PBS_RUBBER_BAR;
	BOOL fRev = info.dwStyle&PBS_REVERSE;

	// calculate visible gradient width
	CRect rcBar(0,0,0,0);
	CRect rcMax(0,0,0,0);
	rcMax.right = fVert ? info.rcClient.Height() : info.rcClient.Width();
	rcBar.right = (int)((float)(info.nCurPos-info.nLower) * rcMax.right / (info.nUpper-info.nLower));
	if(fSnake)
		rcBar.left = (int)((float)(m_nTail-info.nLower) * rcMax.right / (info.nUpper-info.nLower));
	
	// draw bar
	if(m_pbrBar)
		info.pDC->FillRect(&ConvertToReal(info, rcBar), m_pbrBar);
	else
	{
		CRect rcMaxT(fRubberBar ? rcBar : rcMax);
		SetDirection(fVert ? (fRev ? TTB : BTT) : (fRev ? RTL : LTR));
		DrawLinearGradient(info.pDC, ConvertToReal(info, rcMaxT), rcBar.left-rcMaxT.left, rcBar.right-rcMaxT.left, rcMaxT.Width()*m_nAnimPos/(info.nUpper-info.nLower));
// 		static i = 0;
// 		DrawLinearGradient(info.pDC, ConvertToReal(info, rcMaxT), 0,-1, i+=m_nStep);
	}
	// Draw text
	DrawText(info, rcMax, rcBar);
	// Do not call CProgressCtrl::OnPaint() for painting messages
}

void CProgress::DrawText(const CDrawInfo& info, const CRect &rcMax, const CRect &rcBar)
{
	if(!(info.dwStyle&PBS_TEXTMASK))
		return;
	BOOL fVert = info.dwStyle&PBS_VERTICAL;
	CDC *pDC = info.pDC;

	CString sText = FormatText(info, GetText(), CalcPos(info));
	if (sText.IsEmpty())
		return;

	CFont* pFont = GetFont();
	CSelFont sf(pDC);
	if(pFont)
		sf.Select(pFont);
	CSelTextColor tc(pDC, m_clrTextOnBar);
	CSelBkMode bm(pDC, TRANSPARENT);
	CSelTextAlign ta(pDC, TA_BOTTOM|TA_CENTER);
	CPoint ptWOrg = pDC->GetWindowOrg();
	
	LONG grad = 0;
	if(pFont)
	{
		LOGFONT lf;
		pFont->GetLogFont(&lf);
		grad = lf.lfEscapement/10;
	}
	CSize sizText = pDC->GetTextExtent(sText);
	int cx = 0, cy = 0, dx = 0, dy = 0;
#ifdef PBT_ANY_ANGLE 
	// required "math.h"
	double pi = 3.1415926535;
	double rad = grad*pi/180;
	double nSin = sin(rad);
	double nCos = cos(rad);
	dx = (int)(sizText.cy*nSin);
	dy = (int)(sizText.cy*nCos);
	cx = (int)(fabs(sizText.cy*nSin) + fabs(sizText.cx*nCos));
	cy = (int)(fabs(sizText.cy*nCos) + fabs(sizText.cx*nSin));
#else //!PBT_ANY_ANGLE
	if(grad == 0)         {	cx = sizText.cx; cy = sizText.cy; dx = 0; dy = sizText.cy;}
	else if(grad == 90)   {	cx = sizText.cy; cy = sizText.cx; dx = sizText.cy; dy = 0;}
	else if(grad == 180)  {	cx = sizText.cx; cy = sizText.cy; dx = 0; dy = -sizText.cy;}
	else if(grad == 270)  {	cx = sizText.cy; cy = sizText.cx; dx = -sizText.cy; dy = 0;}
	else ASSERT(0); // angle not supported
#endif //PBT_ANY_ANGLE
	
	CPoint ptVpOrgOld = pDC->GetViewportOrg();
	if(info.dwStyle&PBS_TIED_TEXT)
	{
		CRect rcFill(ConvertToReal(info, rcBar));
		if((fVert ? cy : cx) <= rcBar.Width())
		{
			// align text
			if(info.dwStyle&PBS_LEFT)
				dx += -(rcFill.Width()-cx); 
			if(info.dwStyle&PBS_RIGHT)
				dx += (rcFill.Width()-cx); 
			if(info.dwStyle&PBS_TOP)
				dy += -(rcFill.Height()-cy); 
			if(info.dwStyle&PBS_BOTTOM)
				dy += (rcFill.Height()-cy); 

			pDC->SetViewportOrg(rcFill.left + (rcFill.Width() + dx)/2, 
													rcFill.top + (rcFill.Height() + dy)/2);
			DrawClippedText(info, rcBar, sText, ptWOrg);
		}
	}
	else
	{
		// align text
		if(info.dwStyle&PBS_LEFT)
			dx += -(info.rcClient.Width()-cx); 
		if(info.dwStyle&PBS_RIGHT)
			dx += (info.rcClient.Width()-cx); 
		if(info.dwStyle&PBS_TOP)
			dy += -(info.rcClient.Height()-cy); 
		if(info.dwStyle&PBS_BOTTOM)
			dy += (info.rcClient.Height()-cy); 

		pDC->SetViewportOrg(info.rcClient.left + (info.rcClient.Width() + dx)/2, 
		                    info.rcClient.top + (info.rcClient.Height() + dy)/2);
		
		// draw text on background
		tc.Select(m_clrTextOnBk);
		DrawClippedText(info, rcMax, sText, ptWOrg);

		if(m_clrTextOnBar != m_clrTextOnBk)
		{
			// if different colors on bar and background - draw text on gradient
			tc.Select(m_clrTextOnBar);
			DrawClippedText(info, rcBar, sText, ptWOrg);
		}
	}
	pDC->SetViewportOrg(ptVpOrgOld);
}

float CProgress::CalcPos(const CDrawInfo& info)
{
	DWORD dwTextFormat = info.dwStyle&PBS_TEXTMASK;
	if(dwTextFormat == PBS_SHOW_PERCENT)
		// get current position in percents
		return ((float)(info.nCurPos-info.nLower) * 100 / (info.nUpper-info.nLower));
	if(dwTextFormat == PBS_SHOW_POSITION)
		// get absolute value of current position
		return (float)info.nCurPos;
	return (float)0;
}

CString CProgress::FormatText(const CDrawInfo& info, CString sFormat, float nValue)
{
	if(sFormat.IsEmpty())
	{
		// get default format
		DWORD dwTextFormat = info.dwStyle&PBS_TEXTMASK;
		if(dwTextFormat == PBS_SHOW_PERCENT)
			sFormat = "%d%%";
		else if(dwTextFormat == PBS_SHOW_POSITION)
			sFormat = "%d";
		else
			return "";
	}

	CString sText;
	sText.Format(sFormat, (int)nValue);
	return sText;
}

void CProgress::DrawClippedText(const CDrawInfo& info, const CRect& rcClip, CString& sText, const CPoint& ptWndOrg)
{
	CDC *pDC = info.pDC;
	CRgn rgn;
	CRect rc = ConvertToReal(info, rcClip);
	if(rc.IsRectEmpty())
		return;
	rc.OffsetRect(-ptWndOrg);
	rgn.CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
	pDC->SelectClipRgn(&rgn);
	pDC->TextOut (0, 0, sText);
	rgn.DeleteObject();
}

void CProgress::SetRange(int nLower, int nUpper)
{
	ASSERT(nLower < nUpper);

	if(nLower < nUpper)
	{
		m_nLower = nLower; 
		m_nUpper = nUpper;
	}
	else
	{
		m_nLower = nUpper; 
		m_nUpper = nLower;
	}
	UpdatePos(m_nPos);
}

int CProgress::SetPos(int nPos)
{
	int nOldPos = m_nPos;
	if(SetSnakePos(nPos))
		return nOldPos;

	UpdatePos(nPos);
	return nOldPos;
}

int CProgress::OffsetPos(int nIncrement)
{
	int nOldPos = m_nPos;
	if(SetSnakePos(nIncrement, TRUE))
		return nOldPos;

	UpdatePos(m_nPos + nIncrement);

	return nOldPos;
}

int CProgress::SetStep(int nStep)
{
	int nOldStep = m_nStep;
	m_nStep = nStep;
	return nOldStep;
}

int CProgress::StepIt()
{
	return OffsetPos(m_nStep);
}

/
// CProgress implementation

BOOL CProgress::SetSnakePos(int nNewPos, BOOL fIncrement)
{
	DWORD dwStyle = GetBarStyle();
	if(!(dwStyle&PBS_SNAKE))
		return FALSE;
	
	int nLower, nUpper;
	GetRange(nLower, nUpper);
	if(fIncrement)
	{
		int nCurPos = GetPos();
		if(nCurPos == nUpper && nCurPos - m_nTail < m_nTailSize )
			nCurPos = m_nTail + m_nTailSize;
		nNewPos = nCurPos + abs(nNewPos);
	}
	if(nNewPos > nUpper+m_nTailSize)
	{
		nNewPos -= nUpper-nLower + m_nTailSize;
		if(nNewPos > nUpper + m_nTailSize)
		{
			ASSERT(0); // too far - reset
			nNewPos = nUpper + m_nTailSize;
		}
		if(dwStyle&PBS_REVERSE)
			ModifyBarStyle(PBS_REVERSE, 0);
		else
			ModifyBarStyle(0, PBS_REVERSE);
	}
//	else if(nNewPos >= nUpper)
//		Invalidate();
	
	m_nTail = nNewPos - m_nTailSize;
	if(m_nTail < nLower)
		m_nTail = nLower;

	UpdatePos(nNewPos);

	return TRUE;
}

void CProgress::SetTextFormat(LPCTSTR szFormat, DWORD ffFormat)
{
	if(!szFormat || !szFormat[0] || !ffFormat)
	{
		ModifyBarStyle(PBS_TEXTMASK, 0);
		SetText("");
	}
	else
	{
		ModifyBarStyle(PBS_TEXTMASK, ffFormat);
		SetText(szFormat);
	}
}

CRect CProgress::ConvertToReal(const CDrawInfo& info, const CRect& rcVirt)
{
	BOOL fReverse = info.dwStyle&PBS_REVERSE;
	BOOL fVert = info.dwStyle&PBS_VERTICAL;

	CRect rc(info.rcClient);
	if(fVert)
	{
		rc.top = info.rcClient.top + 
		         (fReverse ? rcVirt.left : (info.rcClient.Height() - rcVirt.right));
		rc.bottom = rc.top + rcVirt.Width();
	}
	else
	{
		rc.left = info.rcClient.left + 
		          (fReverse ? (info.rcClient.Width() - rcVirt.right) : rcVirt.left);
		rc.right = rc.left + rcVirt.Width();
	}
	return rc;
}

BOOL CProgress::SetShape(HRGN hRgn)
{	
	m_rgnShape.DeleteObject();
	if(!hRgn)
		return TRUE;
	return m_rgnShape.Attach(hRgn);
}

void CProgress::UpdatePos(int nNewPos, BOOL fForse)
{
	if(nNewPos > m_nUpper) nNewPos = m_nUpper;
	if(nNewPos < m_nLower) nNewPos = m_nLower;

	if(m_nPos == nNewPos)
		return;

	BOOL fChange = OnPosChanging(m_nPos, nNewPos);
	if(fForse || fChange)
	{
		m_nPos = nNewPos;
		OnPosChanged(nNewPos);
	}
}

.\ProgressCtrlX.cpp  文件内容

///
// class CProgressCtrlX
//
// Author:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
// Copyright ?2000, Yury Goltsman
//
// This code provided "AS IS," without warranty of any kind.
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// version : 1.4
// Gradient Animation added
//
// version : 1.3
// Most code separated to window independent base classes 
//    (maximum compatibility with previous version)
// Added support for ToolTips
// Added self running snake
//
// version : 1.2
// Added support for "Any angle text rotation" 
//   (define PBT_ANY_ANGLE and set font with appropriated angle)
// Added text alignment
// Added possibility to format text (via virtual function FormatText())
//   e.g. you can show percent as decimal fraction instead of integer
//
// version : 1.1
// Added multi-color gradient
// Added filling with brush for background and bar(overrides color settings)
// Added borders attribute
// Added vertical text support
// Added snake mode
// Added reverse mode
// Added dual color for text
// Added text formatting
// Added tied mode for text and rubber bar mode
// Added support for vertical oriented control(PBS_VERTICAL)
// 
// version : 1.0
//

#include "stdafx.h"
#include "ProgressCtrlX.h"

#include "MemDC.h"
#include "DrawGdiX.h"

#ifdef PBT_ANY_ANGLE
	#include <math.h>
#endif

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

/
// CProgressCtrlX

bool CProgressCtrlX::s_bSmooth = false;
bool CProgressCtrlX::s_bIsXP = false;


bool IsVista()
{
	OSVERSIONINFOEX m_osvi;
	::ZeroMemory(&m_osvi, sizeof(OSVERSIONINFOEX));
    m_osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	::GetVersionEx((LPOSVERSIONINFO)&m_osvi);
	if(m_osvi.dwMajorVersion == 6 && m_osvi.dwMinorVersion == 0)
	{
		return true;
	}
	return false;
}

bool IsXP()
{
	OSVERSIONINFOEX m_osvi;
	::ZeroMemory(&m_osvi, sizeof(OSVERSIONINFOEX));
    m_osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	::GetVersionEx((LPOSVERSIONINFO)&m_osvi);
	if(m_osvi.dwMajorVersion == 5 && m_osvi.dwMinorVersion == 1)
	{
		return true;
	}
	return false;
}

CProgressCtrlX::CProgressCtrlX()
{
	m_fToolTipFormat = 0;
	if(IsVista())
		s_bSmooth = true;
#ifdef _DEBUG	
	s_bSmooth = true;
#endif
	if(IsXP())
		s_bIsXP = true;
// #ifdef _DEBUG	
// 	s_bIsXP = true;
// #endif
}

BEGIN_MESSAGE_MAP(CProgressCtrlX, CProgressCtrl)
	//{{AFX_MSG_MAP(CProgressCtrlX)
	ON_WM_ERASEBKGND()
	ON_WM_PAINT()
	ON_MESSAGE(PBM_SETBARCOLOR, OnSetBarColor)
	ON_MESSAGE(PBM_SETBKCOLOR, OnSetBkColor)
	ON_MESSAGE(PBM_GETPOS, OnGetPos)
	ON_MESSAGE(PBM_SETPOS, OnSetPos)
	ON_MESSAGE(PBM_DELTAPOS, OnDeltaPos)
	ON_MESSAGE(PBM_STEPIT, OnStepIt)
	ON_MESSAGE(PBM_SETSTEP, OnSetStep)
	ON_MESSAGE(PBM_GETRANGE, OnGetRange)
	ON_MESSAGE(PBM_SETRANGE, OnSetRange)
	ON_MESSAGE(PBM_SETRANGE32, OnSetRange32)
	ON_MESSAGE(WM_SETTEXT, OnSetText)
	ON_MESSAGE(WM_GETTEXT, OnGetText)
	ON_MESSAGE(WM_GETTEXTLENGTH, OnGetTextLength)
	ON_MESSAGE(WM_GETFONT, OnGetFont)
	ON_MESSAGE(WM_SETFONT, OnSetFont)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CProgressCtrlX message handlers

BOOL CProgressCtrlX::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	return TRUE; // erase in OnPaint()
}

void CProgressCtrlX::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	// TODO: Add your message handler code here
	CRect rc;
	GetClientRect(&rc);

	CPalette *pOldPal = NULL;
	if (GetCreatePalette() && GetPalette().GetSafeHandle())
	{
		pOldPal = dc.SelectPalette(&GetPalette(), FALSE);
		dc.RealizePalette();
	}

	Draw(&dc, rc);

	if(pOldPal)
		dc.SelectPalette(pOldPal, TRUE);
	// Do not call CProgressCtrl::OnPaint() for painting messages
}

LRESULT CProgressCtrlX::OnSetBarColor(WPARAM clrEnd, LPARAM clrStart)
{
	SetGradientColors(clrStart, clrEnd ? clrEnd : clrStart);

	return CLR_DEFAULT;
}

LRESULT CProgressCtrlX::OnSetBkColor(WPARAM, LPARAM clrBk)
{
	SetBkColor(clrBk);
	return CLR_DEFAULT;
}

LRESULT CProgressCtrlX::OnSetStep(WPARAM nStepInc, LPARAM)
{
	int res = CProgress::SetStep(nStepInc);
	Invalidate();
	return res;
}

LRESULT CProgressCtrlX::OnGetPos(WPARAM, LPARAM)
{
	return CProgress::GetPos();
}

LRESULT CProgressCtrlX::OnSetPos(WPARAM newPos, LPARAM)
{
	int res = CProgress::SetPos(newPos);
	Invalidate();
	return res;
}

LRESULT CProgressCtrlX::OnGetRange(WPARAM wParam, LPARAM lParam)
{
	int Low, Hi;
	CProgress::GetRange(Low, Hi);
	if(lParam)
	{
		PPBRANGE ppBRange = (PPBRANGE)lParam;
		ppBRange->iHigh = Hi;
		ppBRange->iLow = Low;
	}
	return wParam ? Low : Hi;
}

LRESULT CProgressCtrlX::OnSetRange(WPARAM, LPARAM lParam)
{
	return OnSetRange32(LOWORD(lParam), HIWORD(lParam));
}

LRESULT CProgressCtrlX::OnSetRange32(WPARAM low, LPARAM hi)
{
	int oldLow, oldHi;
	CProgress::GetRange(oldLow, oldHi);
	CProgress::SetRange(low, hi);
	Invalidate();
	return MAKELRESULT(oldLow, oldHi);
}

LRESULT CProgressCtrlX::OnDeltaPos(WPARAM nIncrement, LPARAM)
{
	int res = CProgress::OffsetPos(nIncrement);
	Invalidate();
	return res;
}

LRESULT CProgressCtrlX::OnStepIt(WPARAM, LPARAM)
{
	int res = CProgress::StepIt();
	Invalidate();
	return res;
}

LRESULT CProgressCtrlX::OnSetText(WPARAM, LPARAM lParam)
{
	CProgress::SetText((LPCTSTR)lParam);
	Invalidate();
	return TRUE;
}

LRESULT CProgressCtrlX::OnGetFont(WPARAM, LPARAM)
{
	CFont* pFont = CProgress::GetFont();
	if(!pFont)
		return NULL;
	return (LRESULT)pFont->GetSafeHandle();
}

LRESULT CProgressCtrlX::OnSetFont(WPARAM hFont, LPARAM lParam)
{
	CProgress::SetFont(CFont::FromHandle((HFONT)hFont));
	if(LOWORD(lParam))
		RedrawWindow();
	return 0;
}

LRESULT CProgressCtrlX::OnGetText(WPARAM nCount, LPARAM pBuf)
{
	CString sText = CProgress::GetText();
	_tcsncpy((TCHAR* )pBuf, sText, nCount);
	return min(nCount, (UINT)sText.GetLength());
}

LRESULT CProgressCtrlX::OnGetTextLength(WPARAM, LPARAM)
{
	return CProgress::GetText().GetLength();
}

void CProgressCtrlX::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if(nIDEvent == SnakeTimer)
		StepIt();
	else if(nIDEvent == AnimationTimer)
	{
		Animate(m_nAnimStep);
		Invalidate();
	}

	CProgressCtrl::OnTimer(nIDEvent);
}

BOOL CProgressCtrlX::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (m_wndToolTip.GetSafeHwnd () != NULL)
	{
		if (pMsg->message == WM_MOUSEMOVE)
		{
			m_wndToolTip.RelayEvent(pMsg);
		}
	}
	
	return CProgressCtrl::PreTranslateMessage(pMsg);
}

void CProgressCtrlX::SetTooltipFormat (LPCTSTR lpszToolTipText, DWORD fFormat)
{
	ASSERT (GetSafeHwnd () != NULL);

	m_sToolTipText = lpszToolTipText;
	m_fToolTipFormat = (fFormat & PBS_TEXTMASK);
	if (lpszToolTipText == NULL || lpszToolTipText[0] == 0 || !m_fToolTipFormat)
	{
		if (m_wndToolTip.GetSafeHwnd () != NULL)
			m_wndToolTip.Activate (FALSE);
	}
	else
	{
		if (m_wndToolTip.GetSafeHwnd () == NULL)
		{
			m_wndToolTip.Create (this, TTS_ALWAYSTIP|TTS_NOPREFIX);
			m_wndToolTip.AddTool (this, "");
			UpdateTooltipText(CProgress::GetPos());
		}

		ASSERT (m_wndToolTip.GetSafeHwnd () != NULL);
		m_wndToolTip.Activate (TRUE);
	}
}

void CProgressCtrlX::UpdateTooltipText(int nPos)
{
	if (m_wndToolTip.GetSafeHwnd () == NULL)
		return;
	CDrawInfo info;
	// retrieve current position and range
	info.nCurPos = nPos;
	CProgress::GetRange(info.nLower, info.nUpper);
	info.dwStyle = m_fToolTipFormat;
	CString sText = FormatText(info, GetTooltipText(), CalcPos(info));
	if (!sText.IsEmpty())
		m_wndToolTip.UpdateTipText(sText, this);
}
.\StdAfx.cpp 文件内容

// stdafx.cpp : source file that includes just the standard includes
//	MSIUI.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"





文件头内容如下:


.\ColorStatic.h 文件内容

// This file was created on March 28th 2001. By Robert Brault
//
//

#if !defined(AFX_COLORSTATIC_H__614C19E7_EA25_42DF_928A_51AC901B813D__INCLUDED_)
#define AFX_COLORSTATIC_H__614C19E7_EA25_42DF_928A_51AC901B813D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ColorStatic.h : header file
//

#define RED        RGB(127,  0,  0)
#define GREEN      RGB(  0,127,  0)
#define BLUE       RGB(  0,  0,127)
#define LIGHTRED   RGB(255,  0,  0)
#define LIGHTGREEN RGB(  0,255,  0)
#define LIGHTBLUE  RGB(  0,  0,255)
#define BLACK      RGB(  0,  0,  0)
#define WHITE      RGB(255,255,255)
#define GRAY       RGB(192,192,192)

/
// CColorStatic window

class CColorStatic : public CStatic
{
// Construction
public:
	void SetTextColor(COLORREF crColor); // This Function is to set the Color for the Text.
	void SetBkColor(COLORREF crColor); // This Function is to set the BackGround Color for the Text.
	CColorStatic();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CColorStatic)
	//}}AFX_VIRTUAL

	virtual ~CColorStatic();

	// Generated message map functions
protected:
	//{{AFX_MSG(CColorStatic)

	CBrush m_brBkgnd; // Holds Brush Color for the Static Text
	COLORREF m_crBkColor; // Holds the Background Color for the Text
	COLORREF m_crTextColor; // Holds the Color for the Text

	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COLORSTATIC_H__614C19E7_EA25_42DF_928A_51AC901B813D__INCLUDED_)

.\Drawgdix.h 文件内容

#ifndef DRAWGDIX_H
#define DRAWGDIX_H

/*******************************************************************

GDI Helper Classes, MFC Version, by G. Bavestrelli, Techint S.p.A.
Any feedback is welcome, you can contact me at:
					  giovanni.bavestrelli@pomini.it

class CSelStock
class CSelPen
class CSelBrush
class CSelFont
class CSelBitmap
class CSelPalette
class CSelROP2
class CSelBkMode
class CSelBkColor
class CSelTextColor
class CSelTextAlign
class CSelMapMode
class CSaveDC

class CSelStock
	CSelStock(CDC * pDC, int index)
	void Select(int index)
	CGdiObject * Old()

class CSelPen
	CSelPen(CDC * pDC, COLORREF col, int sty=PS_SOLID, int wid = 0)
	CSelPen(CDC * pDC, CPen * pPen)
	void Select(CPen * pPen)
	void Select(COLORREF col, int sty=PS_SOLID, int wid = 0)

class CSelBrush
	CSelBrush(CDC * pDC, CBrush * pBrush)
	CSelBrush(CDC * pDC, COLORREF crColor)
	CSelBrush(CDC * pDC, int index, COLORREF crColor)    // Hatch brush
	CSelBrush(CDC * pDC, CBitmap * pBitmap)              // Pattern brush
	CSelBrush(CDC * pDC, HGLOBAL hPackedDib, UINT usage) // DIB Pattern brush
	void Select(CBrush * pBrush)
	void Select(COLORREF col)
	void Select(int index, COLORREF col)                 // Hatch brush
	void Select(CBitmap * pBitmap)                       // Pattern brush
	void Select(HGLOBAL hPackedDib, UINT usage)          // DIB Pattern brush

class CSelFont
	CSelFont(CDC * pDC, int size, LPCTSTR face = NULL, BOOL bold = 0,
				BOOL italic = 0, BOOL underlined = 0, BOOL fixed = 0,
				BOOL hiquality = 0, int angleindegrees = 0)
	CSelFont(CDC * pDC, CFont * pFont)
	CSelFont(CDC * pDC, const LOGFONT* lpLogFont)

	void Select(int size, LPCTSTR face = NULL, BOOL bold = 0,
					BOOL italic = 0, BOOL underlined = 0, BOOL fixed = 0,
					BOOL hiquality = 0, int angleindegrees = 0)
	void Select(CFont * pFont)
	void Select(const LOGFONT* lpLogFont)

class CSelBitmap
	CSelBitmap(CDC * pDC, CBitmap * pBitmap)
	CSelBitmap(CDC * SelectInDC, CDC * pCompatibleToDC, int w, int h)
	void Select(CBitmap * pBitmap)
	void Select(CDC * pCompatibleToDC, int w, int h)

class CSelPalette
	CSelPalette(CDC * pDC, CPalette * pPalette,
	            BOOL fForceBackground = FALSE, BOOL fRealize = TRUE)
	UINT Select(CPalette * pPalette,
	            BOOL fForceBackground = FALSE, BOOL fRealize = TRUE)
	void ChangeRestoreFlags(BOOL fForceBackground, BOOL fRealize)

class CSelROP2
	CSelROP2(CDC * pDC, int drawMode)
	void Select(int drawmode)

class CSelBkMode
	CSelBkMode(CDC * pDC, int BkMode)
	void Select(int bkmode)

class CSelBkColor
	CSelBkColor(CDC * pDC, COLORREF BkColor)
	void Select(COLORREF color)

class CSelTextColor
	CSelTextColor(CDC * pDC, COLORREF TextColor)
	void Select(COLORREF color)

class CSelTextAlign
	CSelTextAlign(CDC * pDC, UINT TextAlign)
	void Select(UINT align)

class CSelMapMode
	CSelMapMode(CDC * pDC, int MapMode)
	void Select(int mode)

class CSaveDC
	CSaveDC(CDC * pDC) // saving the complete state of the DC

every class also have:
	<Constructor>(CDC* pDC) // constructor w/o selection
	void Restore()          // restores original object and destroys new object if neccessary
	<retval> Old()          // returns original object

*******************************************************************/

//******************************************************************
// Base class, stores CDC *
//******************************************************************

class CSelect
{
protected:
	CDC * const m_pDC;
	CSelect(CDC * pDC):m_pDC(pDC) 	{ ASSERT(m_pDC);}
	virtual ~CSelect() {}

private:

	// Disable copying
	operator = (const CSelect & d);
	CSelect(const CSelect &);
};

//******************************************************************
// Class for Stock Objects
//******************************************************************

class CSelStock : public CSelect
{
	CGdiObject * m_pOldObj;

public:

	CSelStock(CDC * pDC)
		:CSelect(pDC), m_pOldObj(NULL) {}

	CSelStock(CDC * pDC, int index)
		:CSelect(pDC), m_pOldObj(NULL)
		{ Select(index); }

	~CSelStock() { Restore(); }

	void Select(int index)
	{
		CGdiObject * pOld = m_pDC->SelectStockObject(index); ASSERT(pOld);
		if (!m_pOldObj) m_pOldObj = pOld;
	}

	void Restore()
	{
		if (m_pOldObj) VERIFY(m_pDC->SelectObject(m_pOldObj));
		m_pOldObj = NULL;
	}

	CGdiObject * Old() const { return m_pOldObj; }
};

//******************************************************************
// Pens
//******************************************************************

class CSelPen	: public CSelect
{
	CPen	 m_NewPen;
	CPen * m_pOldPen;

public:

	CSelPen(CDC * pDC)
	  :CSelect(pDC), m_pOldPen(NULL){}

	CSelPen(CDC * pDC, COLORREF col, int sty = PS_SOLID, int wid = 0)
		:CSelect(pDC), m_pOldPen(NULL)
		{ Select(col, sty, wid); }

	CSelPen(CDC * pDC, CPen * pPen)
		:CSelect(pDC), m_pOldPen(NULL)
		{ Select(pPen); }

	~CSelPen() { Restore(); }

	void Select(CPen * pPen)
	{
		ASSERT(pPen);
		ASSERT(pPen != &m_NewPen);
		CPen * pOld = m_pDC->SelectObject(pPen); ASSERT(pOld);
		if (!m_pOldPen) m_pOldPen = pOld;
		m_NewPen.DeleteObject();
	}

	void Select(COLORREF col, int sty = PS_SOLID, int wid = 0)
	{
		if (m_pOldPen) Select(m_pOldPen);
		VERIFY(m_NewPen.CreatePen(sty, wid, col));
		VERIFY(m_pOldPen = m_pDC->SelectObject(&m_NewPen));
	}

	void Restore()
	{
		if (m_pOldPen) VERIFY(m_pDC->SelectObject(m_pOldPen));
		m_pOldPen = NULL;
		m_NewPen.DeleteObject();
	}

	CPen * Old() const	 { return m_pOldPen; }
};

//******************************************************************
// Brushes
//******************************************************************

class CSelBrush  : public CSelect
{
	 CBrush	 m_NewBrush;
	 CBrush * m_pOldBrush;

public:
	CSelBrush(CDC * pDC)
		:CSelect(pDC), m_pOldBrush(NULL) {}

	// Solid brush
	CSelBrush(CDC * pDC, COLORREF crColor)
		:CSelect(pDC), m_pOldBrush(NULL)
		{ Select(crColor); }

	// Hatch brush
	CSelBrush(CDC * pDC, int index, COLORREF crColor)
		:CSelect(pDC), m_pOldBrush(NULL)
		{ Select(index, crColor); }

	// Pattern brush
	CSelBrush(CDC * pDC, CBitmap * pBitmap)
		:CSelect(pDC), m_pOldBrush(NULL)
		{ Select(pBitmap); }

	// DIB Pattern brush
	CSelBrush(CDC * pDC, HGLOBAL hPackedDib, UINT usage)
	  :CSelect(pDC), m_pOldBrush(NULL)
		{ Select(hPackedDib, usage); }

	CSelBrush(CDC * pDC, CBrush * pBrush)
	  :CSelect(pDC), m_pOldBrush(NULL)
		{ Select(pBrush); }

	~CSelBrush() { Restore(); }

	void Select(CBrush * pBrush)
	{
		ASSERT(pBrush);
		ASSERT(pBrush != &m_NewBrush);
		CBrush * pOld = m_pDC->SelectObject(pBrush); ASSERT(pOld);
		if (!m_pOldBrush) m_pOldBrush=pOld;
		m_NewBrush.DeleteObject();
	}

	// Solid brush
	void Select(COLORREF col)
	{
		if (m_pOldBrush) Select(m_pOldBrush);
		VERIFY(m_NewBrush.CreateSolidBrush(col));
		VERIFY(m_pOldBrush = m_pDC->SelectObject(&m_NewBrush));
	}

	// Hatch brush
	void Select(int index, COLORREF col)
	{
		if (m_pOldBrush) Select(m_pOldBrush);
		VERIFY(m_NewBrush.CreateHatchBrush(index, col));
		VERIFY(m_pOldBrush = m_pDC->SelectObject(&m_NewBrush));
	}

	// Pattern brush
	void Select(CBitmap * pBitmap)
	{
		ASSERT(pBitmap);
		if (m_pOldBrush) Select(m_pOldBrush);
		VERIFY(m_NewBrush.CreatePatternBrush(pBitmap));
		VERIFY(m_pOldBrush = m_pDC->SelectObject(&m_NewBrush));
	}

	// DIB Pattern brush
	void Select(HGLOBAL hPackedDib, UINT usage)
	{
		if (m_pOldBrush) Select(m_pOldBrush);
		VERIFY(m_NewBrush.CreateDIBPatternBrush(hPackedDib, usage));
		VERIFY(m_pOldBrush=m_pDC->SelectObject(&m_NewBrush));
	}

	void Restore()
	{
		if (m_pOldBrush) VERIFY(m_pDC->SelectObject(m_pOldBrush));
		m_pOldBrush = NULL;
		m_NewBrush.DeleteObject();
	}

	CBrush * Old() const 	{ return m_pOldBrush; }
};



//******************************************************************
// My own font with different constructor and creation function
//******************************************************************

class CMyFont : public CFont
{
public:
	CMyFont(){}
	CMyFont(CDC * pDC, int size, LPCTSTR face = NULL, BOOL bold = 0,
	        BOOL italic = 0, BOOL underlined = 0, BOOL fixed = 0,
	        BOOL hiquality = 0, int angleindegrees = 0)
	{
		VERIFY(MyCreateFont(pDC, size, face, bold, italic, underlined,
		                    fixed, hiquality, angleindegrees));
	}
	BOOL MyCreateFont(CDC * pDC, int size, LPCTSTR face = NULL,
	                  BOOL bold = 0, BOOL italic = 0, BOOL underlined = 0,
	                  BOOL fixed = 0, BOOL hiquality = 0,
	                  int angleindegrees = 0)
	{
		ASSERT(pDC);
		CSize Size(0, MulDiv(size, pDC->GetDeviceCaps(LOGPIXELSY), 72));
		pDC->DPtoLP(&Size);
		return CreateFont(-abs(Size.cy), 0, 10*angleindegrees, 0,
		                  bold ? FW_BOLD : FW_NORMAL, BYTE(italic),
		                  BYTE(underlined), 0, ANSI_CHARSET,
		                  OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
		                  BYTE(hiquality ? PROOF_QUALITY : DEFAULT_QUALITY),
		                  BYTE(fixed ? FF_MODERN|FIXED_PITCH :
		                               FF_SWISS|VARIABLE_PITCH),
		                  face && *face ? face : NULL);
	}
};


//******************************************************************
// Fonts
//******************************************************************


class CSelFont  : public CSelect
{
	CMyFont m_NewFont;
	CFont * m_pOldFont;

public:

	CSelFont(CDC * pDC)
		: CSelect(pDC), m_pOldFont(NULL) {}

	CSelFont(CDC * pDC, int size, LPCTSTR face = NULL, BOOL bold = 0,
	         BOOL italic = 0, BOOL underlined = 0, BOOL fixed = 0,
	         BOOL hiquality = 0, int angleindegrees = 0)
		: CSelect(pDC), m_pOldFont(NULL)
	{
		Select(size, face, bold, italic, underlined, 
		       fixed, hiquality, angleindegrees);
	}

	CSelFont(CDC * pDC, CFont * pFont)
		: CSelect(pDC), m_pOldFont(NULL)
		{ Select(pFont); }

	CSelFont(CDC * pDC, const LOGFONT* lpLogFont)
		: CSelect(pDC), m_pOldFont(NULL)
		{ Select(lpLogFont); }

	~CSelFont() { Restore(); }

	void Select(CFont * pFont)
	{
		ASSERT(pFont);
		ASSERT(pFont != &m_NewFont);
		CFont * pOld = m_pDC->SelectObject(pFont); ASSERT(pOld);
		if (!m_pOldFont) m_pOldFont = pOld;
		m_NewFont.DeleteObject();
	}

	void Select(int size, LPCTSTR face = NULL, BOOL bold = 0,
	            BOOL italic = 0, BOOL underlined = 0, BOOL fixed = 0,
	            BOOL hiquality = 0, int angleindegrees = 0)
	{
		if (m_pOldFont) Select(m_pOldFont);
		VERIFY(m_NewFont.MyCreateFont(m_pDC, size, face, bold, italic,
		                              underlined, fixed, hiquality, angleindegrees));
		VERIFY(m_pOldFont = m_pDC->SelectObject(&m_NewFont));
	}

	void Select(const LOGFONT* lpLogFont)
	{
		if (m_pOldFont) Select(m_pOldFont);
		VERIFY(m_NewFont.CreateFontIndirect(lpLogFont));
		VERIFY(m_pOldFont = m_pDC->SelectObject(&m_NewFont));
	}

	void Restore()
	{
		if (m_pOldFont) VERIFY(m_pDC->SelectObject(m_pOldFont));
		m_pOldFont = NULL;
		m_NewFont.DeleteObject();
	}

	CFont * Old() const	{ return m_pOldFont; }
};


//******************************************************************
// Bitmaps
//******************************************************************

class CSelBitmap	: public CSelect
{
	CBitmap	 m_NewBmp;
	CBitmap * m_pOldBmp;

public:
	CSelBitmap(CDC * pDC)
		: CSelect(pDC), m_pOldBmp(NULL) {}

	CSelBitmap(CDC * SelectInDC, CDC * pCompatibleToDC, int w, int h)
		: CSelect(SelectInDC), m_pOldBmp(NULL)
		{ Select(pCompatibleToDC, w, h); }

	CSelBitmap(CDC * pDC, CBitmap * pBitmap)
		: CSelect(pDC), m_pOldBmp(NULL)
		{ Select(pBitmap); }

	~CSelBitmap() { Restore(); }

	void Select(CBitmap * pBitmap)
	{
		ASSERT(pBitmap);
		ASSERT(pBitmap != &m_NewBmp);
		CBitmap * pOld = m_pDC->SelectObject(pBitmap);	ASSERT(pOld);
		if (!m_pOldBmp) m_pOldBmp = pOld;
		m_NewBmp.DeleteObject();
	}

	void Select(CDC * pCompatibleToDC, int w, int h)
	{
		ASSERT(pCompatibleToDC);
		if (m_pOldBmp) Select(m_pOldBmp);
		VERIFY(m_NewBmp.CreateCompatibleBitmap(pCompatibleToDC, w, h));
		VERIFY(m_pOldBmp = m_pDC->SelectObject(&m_NewBmp));
	}

	void Restore()
	{
		if (m_pOldBmp) VERIFY(m_pDC->SelectObject(m_pOldBmp));
		m_pOldBmp = NULL;
		m_NewBmp.DeleteObject();
	}

	CBitmap * Old() const { return m_pOldBmp; }
};

// This class is a bit different
class CSelPalette  : public CSelect
{
	// You need your own palette, use CPalette
	CPalette * m_pOldPalette;
	BOOL m_fForceBackground;
	BOOL m_fRealizePalette;

public:

	CSelPalette(CDC * pDC)
		: CSelect(pDC), m_pOldPalette(NULL) {}

	CSelPalette(CDC * pDC, CPalette * pPalette,
	            BOOL fForceBackground = FALSE, BOOL fRealize = TRUE)
		: CSelect(pDC), m_pOldPalette(NULL)
		{ Select(pPalette, fForceBackground, fRealize); }

	~CSelPalette() { Restore(); }

	UINT Select(CPalette * pPalette,
	            BOOL fForceBackground = FALSE, BOOL fRealize = TRUE)
	{
		ASSERT(pPalette);
		ASSERT(m_pDC->GetDeviceCaps(RASTERCAPS)&RC_PALETTE);
		CPalette * pOld=m_pDC->SelectPalette(pPalette, fForceBackground);
		ASSERT(pOld);
		if (!m_pOldPalette) m_pOldPalette=pOld;
		m_fForceBackground = fForceBackground;
		m_fRealizePalette = fRealize;
		return fRealize ? m_pDC->RealizePalette() : 0;
	}

	void ChangeRestoreFlags(BOOL fForceBackground, BOOL fRealize)
	{
		m_fForceBackground = fForceBackground;
		m_fRealizePalette = fRealize;
	}
	
	void Restore()
	{
		if (!m_pOldPalette)
			return;

		VERIFY(m_pDC->SelectPalette(m_pOldPalette, m_fForceBackground));
		if (m_fRealizePalette) 
			m_pDC->RealizePalette();
		m_pOldPalette = NULL;
	}

	CPalette * Old() const	{ return m_pOldPalette; }
};


//******************************************************************
// Set and restore other characteristics of the DC (no GDI objects)
//******************************************************************


class CSelROP2 : public CSelect
{
	int m_OldRop;

public:

	CSelROP2(CDC * pDC)
		: CSelect(pDC), m_OldRop(0)
		{ /*VERIFY(m_OldRop=m_pDC->GetROP2());*/ }

	CSelROP2(CDC * pDC, int drawMode)
		: CSelect(pDC), m_OldRop(0)
		{ Select(drawMode); }

	~CSelROP2() { Restore(); }

	void Select(int drawmode)
	{
		int old = m_pDC->SetROP2(drawmode); ASSERT(old);
		if (!m_OldRop) m_OldRop = old;
	}

	void Restore()
	{
		if (m_OldRop) VERIFY(m_pDC->SetROP2(m_OldRop));
		m_OldRop = 0;
	}

	int Old() const { return m_OldRop; }
};


class CSelBkMode : public CSelect
{
	int m_OldBkMode;

public:

	CSelBkMode(CDC * pDC)
		: CSelect(pDC), m_OldBkMode(0)
		{ /*VERIFY(m_OldBkMode = m_pDC->GetBkMode());*/ }

	CSelBkMode(CDC * pDC, int BkMode)
		: CSelect(pDC), m_OldBkMode(0)
		{ Select(BkMode); }

	~CSelBkMode() { Restore(); }

	void Select(int BkMode)
	{
		int old = m_pDC->SetBkMode(BkMode); ASSERT(old);
		if (!m_OldBkMode) m_OldBkMode = old;
	}

	void Restore()
	{
	  if (m_OldBkMode) VERIFY(m_pDC->SetBkMode(m_OldBkMode));
	  m_OldBkMode = 0;
	}

	int Old() const { return m_OldBkMode; }
};


class CSelBkColor : public CSelect
{
	COLORREF m_OldBkColor;

public:

	CSelBkColor(CDC * pDC)
		: CSelect(pDC), m_OldBkColor(CLR_INVALID)
		{ m_OldBkColor = m_pDC->GetBkColor(); }

	CSelBkColor(CDC * pDC, COLORREF BkColor)
	  :CSelect(pDC), m_OldBkColor(CLR_INVALID)
		{ Select(BkColor); }

	~CSelBkColor() { Restore(); }

	void Select(COLORREF color)
	{
		ASSERT(color != CLR_INVALID);
		int old = m_pDC->SetBkColor(color);	ASSERT(old != CLR_INVALID);
		if (m_OldBkColor == CLR_INVALID) m_OldBkColor = old;
	}

	void Restore()
	{
		if(m_OldBkColor == CLR_INVALID) return;
		VERIFY(m_pDC->SetBkColor(m_OldBkColor) != CLR_INVALID);
		m_OldBkColor = CLR_INVALID;
	}

	COLORREF Old() const { return m_OldBkColor; }
};


class CSelTextColor : public CSelect
{
	COLORREF m_OldTextColor;

public:

	CSelTextColor(CDC * pDC)
		: CSelect(pDC), m_OldTextColor(CLR_INVALID)
		{ m_OldTextColor = m_pDC->GetTextColor(); }

	CSelTextColor(CDC * pDC, COLORREF TextColor)
	  :CSelect(pDC), m_OldTextColor(CLR_INVALID)
		{ Select(TextColor); }

	~CSelTextColor() { Restore(); }

	void Select(COLORREF color)
	{
		ASSERT(color != CLR_INVALID);
		int old = m_pDC->SetTextColor(color);	ASSERT(old != CLR_INVALID);
		if (m_OldTextColor == CLR_INVALID) m_OldTextColor = old;
	}

	void Restore()
	{
		if(m_OldTextColor == CLR_INVALID) return;
		VERIFY(m_pDC->SetTextColor(m_OldTextColor) != CLR_INVALID);
		m_OldTextColor = CLR_INVALID;
	}

	COLORREF Old() const { return m_OldTextColor; }
};


class CSelTextAlign : public CSelect
{
	UINT m_OldTextAlign;

public:

	CSelTextAlign(CDC * pDC)
		: CSelect(pDC), m_OldTextAlign(GDI_ERROR)
		{ m_OldTextAlign = m_pDC->GetTextAlign(); }

	CSelTextAlign(CDC * pDC, UINT TextAlign)
		: CSelect(pDC), m_OldTextAlign(GDI_ERROR)
		{ Select(TextAlign); }

	~CSelTextAlign() { Restore(); }

	void Select(UINT align)
	{
		ASSERT(align != GDI_ERROR);
		int old = m_pDC->SetTextAlign(align);	ASSERT(old != GDI_ERROR);
		if (m_OldTextAlign == GDI_ERROR) m_OldTextAlign = old;
	}

	void Restore()
	{
		if(m_OldTextAlign == GDI_ERROR) return;
		VERIFY(m_pDC->SetTextAlign(m_OldTextAlign) != GDI_ERROR);
		m_OldTextAlign = GDI_ERROR;
	}

	UINT Old() const { return m_OldTextAlign; }
};


class CSelMapMode : public CSelect
{
	int m_OldMapMode;

public:

	CSelMapMode(CDC * pDC)
		: CSelect(pDC), m_OldMapMode(0)
		{ /*VERIFY(m_OldMapMode = m_pDC->GetMapMode());*/ }

	CSelMapMode(CDC * pDC, int MapMode)
		: CSelect(pDC), m_OldMapMode(0)
		{ Select(MapMode); }

	~CSelMapMode() { Restore(); }

	void Select(int MapMode)
	{
		int old = m_pDC->SetMapMode(MapMode); ASSERT(old);
		if (!m_OldMapMode) m_OldMapMode = old;
	}

	void Restore()
	{
		if (m_OldMapMode) VERIFY(m_pDC->SetMapMode(m_OldMapMode));
		m_OldMapMode = 0;
	}

	UINT Old() const { return m_OldMapMode; }
};

//******************************************************************
// Class for saving the complete state of the DC
//******************************************************************

class CSaveDC : public CSelect
{
	int m_SavedDC;

public:

	CSaveDC(CDC * pDC)
		: CSelect(pDC)
		{ VERIFY(m_SavedDC = m_pDC->SaveDC()); }

	~CSaveDC() { Restore(); }

	void Restore()
	{
		if (m_SavedDC) VERIFY(m_pDC->RestoreDC(m_SavedDC));
		m_SavedDC = 0;
	}

	int Old() const { return m_SavedDC; }
};


#endif

.\EnumProc.h 文件内容


// MSDN Magazine -- July 2002
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual Studio 6.0 and Visual Studio .NET
// Runs in Windows XP and probably Windows 2000 too.
//
#pragma once

//
// Iterate the top-level windows. Encapsulates ::EnumWindows.
//
class CWindowIterator {
protected:
	HWND*	m_hwnds;				// array of hwnds for this PID
	DWORD m_nAlloc;			// size of array
	DWORD m_count;				// number of HWNDs found
	DWORD m_current;			// current HWND
	static BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lp);

	// virtual enumerator
	virtual BOOL OnEnumProc(HWND hwnd);

	// override to filter different kinds of windows
	virtual BOOL OnWindow(HWND hwnd) {
		return TRUE;
	}

public:
	CWindowIterator(DWORD nAlloc=1024);
	~CWindowIterator();
	
	DWORD GetCount() { return m_count; }
	HWND First();
	HWND Next() {
		return m_hwnds && m_current < m_count ? m_hwnds[m_current++] : NULL;
	}
};

//
// Iterate the top-level windows in a process.
//
class CMainWindowIterator : public CWindowIterator  {
protected:
	DWORD m_pid;							// process id
	virtual BOOL OnWindow(HWND hwnd);
public:
	CMainWindowIterator(DWORD pid, DWORD nAlloc=1024);
	~CMainWindowIterator();
};

//
// Process iterator -- iterator over all system processes
// Always skips the first (IDLE) process with PID=0.
//
class CProcessIterator {
protected:
	DWORD*	m_pids;			// array of procssor IDs
	DWORD		m_count;			// size of array
	DWORD		m_current;		// next array item
public:
	CProcessIterator();
	~CProcessIterator();

	DWORD GetCount() { return m_count; }
	DWORD First();
	DWORD Next() {
		return m_pids && m_current < m_count ? m_pids[m_current++] : 0;
	}
};

//
// Iterate the modules in a process. Note that the first module is the
// main EXE that started the process.
//
class CProcessModuleIterator {
protected:
	HANDLE	m_hProcess;			// process handle
	HMODULE*	m_hModules;			// array of module handles
	DWORD		m_count;				// size of array
	DWORD		m_current;			// next module handle
public:
	CProcessModuleIterator(DWORD pid);
	~CProcessModuleIterator();

	HANDLE GetProcessHandle()	{ return m_hProcess; }
	DWORD GetCount()				{ return m_count; }
	HMODULE First();
	HMODULE Next() {
		return m_hProcess && m_current < m_count ? m_hModules[m_current++] : 0;
	}
};


.\Function.h  文件内容

#ifndef INTERFACE_DEFINE_INCLUDE
#define INTERFACE_DEFINE_INCLUDE

extern "C"
{
	DLLINTERFACE UINT _stdcall ShowDlg(/*HWND hwnd*/);
	DLLINTERFACE UINT _stdcall Install(LPCTSTR fileName, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar);
	DLLINTERFACE UINT _stdcall Uninstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile,BOOL bIsShowNoBar,BOOL bIsRollBack);
	DLLINTERFACE UINT _stdcall Reinstall(LPCTSTR fileName, LPCTSTR guid, LPCTSTR params, LPCTSTR logfile);
	DLLINTERFACE UINT _stdcall HideDlg();
	DLLINTERFACE void _stdcall SetMsiCount(UINT nCount,BOOL bIsRollBack);
	DLLINTERFACE BOOL _stdcall WriteU8SetupReg(int iValue);
}

#endif

.\Gradient.h 文件内容

#if !defined(AFX_GRADIENT_H__2FB4902E_E00C_4892_AA03_60779F349F58__INCLUDED_)
#define AFX_GRADIENT_H__2FB4902E_E00C_4892_AA03_60779F349F58__INCLUDED_

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

///
// class CGradient
//
// Author:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
// Copyright ?2000, Yury Goltsman
//
// This code provided "AS IS," without warranty of any kind.
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// version : 1.1
// Gradient shift added
// Linear Gradient stretch factor
// Per color gradient stretch factor
//
// version : 1.0
// This code is part of CProgressCtrlX and
//   specially oriented for gradient drawing
// Added palette support for 256 colors mode
// Fully rewritten to be more extensible
//

#include <afxtempl.h>

#ifndef UIBITS_API
	#ifdef UIBITS_DLL
		#define  UIBITS_API __declspec(dllexport)
	#else
		#define  UIBITS_API __declspec(dllimport)
	#endif
#endif

struct CGradElement
{
	CGradElement(COLORREF color = 0, int length = 0){this->color = color; this->length = length;}
	COLORREF color;
	int length;
};

typedef CArray<CGradElement, CGradElement&>	CGradArray;

class /*UIBITS_API*/ CGradient  
{
// Construction
public:
	CGradient();
	virtual ~CGradient();

// Attributes
public:
// linear gradient attributes
	enum eDirection{LTR, RTL, TTB, BTT};
	void SetDirection(eDirection fDirection){if(m_fDirection != fDirection){m_fDirection = fDirection;}}
	eDirection GetDirection() {return m_fDirection;}
	void SetStretchGradient(float flStretchFactor = 1); // useful for animation
	float GetStretchGradient() {return m_flStretchGrad;}
// linear gradient operations
	virtual void DrawLinearGradient(CDC *pDC, CRect rcGrad, int nClipStart = 0, int nClipEnd = -1, int nShift = 0);

// attributes
	void SetGradientColors(COLORREF clrStart, COLORREF clrEnd) { SetGradientColorsX(2, clrStart, clrEnd);}
	void GetGradientColors(COLORREF& clrStart, COLORREF& clrEnd); 

	void SetGradientColorsX(int nCount, COLORREF clrFirst, COLORREF clrNext, ...);
	const CDWordArray& GetGradientColorsX() { return m_ardwGradColors; }
	void AddColor(COLORREF clr);
	void SetColorsStretch(double flFirst, ...); // in percent, num of arguments should be one less then num of colors

	void SetCreatePalette(BOOL fCreate = TRUE) {m_fCreatePalette = fCreate;}
	BOOL GetCreatePalette() { return m_fCreatePalette;}
	CPalette& GetPalette() {CreatePalette(); return m_Pal;}

// operations
	virtual void CalcShiftedGradient(CGradArray& arElements, int nShift, int nGradWidth, int nClipStart = 0, int nClipEnd = -1, UINT nMaxColors = (UINT)-1);
	virtual void CalcMultiGradient(CGradArray& arElements, int nGradWidth, int nClipStart = 0, int nClipEnd = -1, UINT nMaxColors = (UINT)-1);
	virtual void CalcGradient(CGradArray& arElements, COLORREF clrStart, COLORREF clrEnd, int nGradWidth, int nClipStart = 0, int nClipEnd = -1, UINT nMaxColors = (UINT)-1);
protected:
	void CreatePalette();
	void NormalizeColorsStretch();

	// color atributes
	CDWordArray m_ardwGradColors;
	BOOL m_fCreatePalette;
	CPalette m_Pal;
private:
	CArray<double, double&> m_arflGradStretch;
protected:
	// linear gradient
	eDirection m_fDirection;
	CRect ConvertToReal(CRect rcDraw, int nBandStart, int nBandEnd);
	float m_flStretchGrad;
};

#endif // !defined(AFX_GRADIENT_H__2FB4902E_E00C_4892_AA03_60779F349F58__INCLUDED_)

.\IObserver.h 文件内容

// IObserver.h: interface for the IObserver class.
//
//

#if !defined(AFX_IOBSERVER_H__2E1A58B7_1C96_40CB_B4C1_0A56FD1CC066__INCLUDED_)
#define AFX_IOBSERVER_H__2E1A58B7_1C96_40CB_B4C1_0A56FD1CC066__INCLUDED_

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

class IObserver  
{
public:
	virtual void SetTitleMsg(const CString& msg) = 0;
	virtual void SetDescMsg(const CString& msg) = 0;
};

#endif // !defined(AFX_IOBSERVER_H__2E1A58B7_1C96_40CB_B4C1_0A56FD1CC066__INCLUDED_)
.\log.h 文件内容

#ifndef LOG_H_INCLUDE_FILE
#define LOG_H_INCLUDE_FILE

void _stdcall WriteLog(LPCTSTR lpSource,LPCTSTR lpMsg);

#endif

.\MemDC.h 文件内容

#if !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
#define AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MemDC.h : header file
//

//
// CMemDC - memory DC
//
// Author: Keith Rule
// Email:  keithr@europa.com
// Copyright 1996-1997, Keith Rule
//
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// History - 10/3/97 Fixed scrolling bug.
//					 Added print support.
//			 25 feb 98 - fixed minor assertion bug
//
// This class implements a memory Device Context

///
// Modified by:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
//
// Modifications provided without warranty of any kind.
//
// version : 1.0
// Added optional parameter : rectangle of dc area
// Added preliminary copying image from orig. dc to bitmap
// (somewhy without this it doesn't work in some places)

class CMemDC : public CDC
{
public:

	// constructor sets up the memory DC
	CMemDC(CDC* pDC, LPRECT pRect = NULL, BOOL fCopyOld = FALSE, BOOL fUsePalette = FALSE) : CDC()
	{
		ASSERT(pDC != NULL);

		m_pDC = pDC;
		m_pOldBitmap = NULL;
		m_bMemDC = !pDC->IsPrinting();
		m_fUsePalette = fUsePalette;

		if (m_bMemDC) // Create a Memory DC
		{
			if(pRect)
				m_rect = *pRect;
			else
				pDC->GetClipBox(&m_rect);
			CreateCompatibleDC(pDC);
			m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
			m_pOldBitmap = SelectObject(&m_bitmap);
			SetWindowOrg(m_rect.left, m_rect.top);
			if(fCopyOld)
				BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
				       m_pDC, m_rect.left, m_rect.top, SRCCOPY);
		}
		else  // Make a copy of the relevent parts of the current DC for printing
		{
			m_bPrinting = pDC->m_bPrinting;
			m_hDC = pDC->m_hDC;
			m_hAttribDC = pDC->m_hAttribDC;
		}
	}
	
	// Destructor copies the contents of the mem DC to the original DC
	~CMemDC()
	{
		if (m_bMemDC) 
		{	 
			CPalette pal, *pOldPal=NULL;
			if(m_fUsePalette && CreatePalette(pal))
			{
				pOldPal = m_pDC->SelectPalette(&pal, FALSE);
				m_pDC->RealizePalette();
			}
			// Copy the offscreen bitmap onto the screen.
			m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
			              this, m_rect.left, m_rect.top, SRCCOPY);

			if(pOldPal)
				m_pDC->SelectPalette(pOldPal, TRUE);
			//Swap back the original bitmap.
			SelectObject(m_pOldBitmap);
		} 
		else 
		{
			// All we need to do is replace the DC with an illegal value,
			// this keeps us from accidently deleting the handles associated with
			// the CDC that was passed to the constructor.
			m_hDC = m_hAttribDC = NULL;
		}
	}

	BOOL CreatePalette(CPalette& pal, CDC* pDC = NULL)
	{
		if(!pDC) pDC = this;
		if(!(pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE))
			return FALSE;

		//Get the DIBSection's color table
		const int nColors = 236;
		RGBQUAD rgb[nColors];
		::GetDIBColorTable(pDC->m_hDC, 0, nColors, rgb);

		//Create a palette from the color table
		LPLOGPALETTE lpPal = (LPLOGPALETTE) new BYTE[sizeof(LOGPALETTE) + (nColors*sizeof(PALETTEENTRY))];
		lpPal->palVersion = 0x300;       
		lpPal->palNumEntries = nColors;

		for (int i = 0; i < nColors; i++)       
		{
			lpPal->palPalEntry[i].peRed = rgb[i].rgbRed;
			lpPal->palPalEntry[i].peGreen = rgb[i].rgbGreen;
			lpPal->palPalEntry[i].peBlue = rgb[i].rgbBlue;
			lpPal->palPalEntry[i].peFlags = 0;
		}
		VERIFY(pal.CreatePalette(lpPal));
  
		//Clean up
		delete lpPal;
		return TRUE;
	}

	// Allow usage as a pointer
	CMemDC* operator->() {return this;}
		
	// Allow usage as a pointer
	operator CMemDC*() {return this;}

private:
	CBitmap  m_bitmap;      // Offscreen bitmap
	CBitmap* m_pOldBitmap;  // bitmap originally found in CMemDC
	CDC*     m_pDC;         // Saves CDC passed in constructor
	CRect    m_rect;        // Rectangle of drawing area.
	BOOL     m_bMemDC;      // TRUE if CDC really is a Memory DC.
	BOOL     m_fUsePalette; // if necessary create and select palette
};

/

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)

.\MSIProgressDlg.h 文件内容

#if !defined(AFX_MSIPROGRESSDLG_H__727AE546_1D0A_4997_B5A8_637BCCF5F6C8__INCLUDED_)
#define AFX_MSIPROGRESSDLG_H__727AE546_1D0A_4997_B5A8_637BCCF5F6C8__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MSIProgressDlg.h : header file
//
#include "IObserver.h"
#include "ColorStatic.h"
#include "ProgressCtrlX.h"
/
// CMSIProgressDlg dialog

class CMSIProgressDlg : public CDialog, IObserver
{
// Construction
public:
	CMSIProgressDlg(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CMSIProgressDlg)
	enum { IDD = IDD_MAIN };
	CProgressCtrlX	m_ProgressBar;
	CColorStatic	m_Description;
	CColorStatic	m_TotalTitle;
	CColorStatic	m_MsiTitle;
	//}}AFX_DATA


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

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CMSIProgressDlg)
	virtual BOOL OnInitDialog();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnCancel();
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

protected:
	CBrush m_DlgColor;

public:
	UINT DoInstall(const CString& fileName, const CString& params, const CString& logfile,BOOL bIsShowNoBar);
	UINT DoUninstall(const CString& fileName, const CString& proCode, const CString& params, const CString& logfile,BOOL bIsShowNoBar,BOOL bIsRollBack);
	UINT DoReinstall(const CString& fileName, const CString& proCode, const CString& params, const CString& logfile);
private:
	void SetTotalTitle();
	void SetMsiTitle(const CString& fileName);
	void SetLog(const CString& logfile);
public:
	virtual void SetTitleMsg(const CString& msg);
	virtual void SetDescMsg(const CString& msg);

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MSIPROGRESSDLG_H__727AE546_1D0A_4997_B5A8_637BCCF5F6C8__INCLUDED_)
.\MSIUI.h 文件内容

// MSIUI.h : main header file for the MSIUI DLL
//

#if !defined(AFX_MSIUI_H__D12B5A44_3F6E_4DCF_9022_E4FB06CE8862__INCLUDED_)
#define AFX_MSIUI_H__D12B5A44_3F6E_4DCF_9022_E4FB06CE8862__INCLUDED_

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

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols

/
// CMSIUIApp
// See MSIUI.cpp for the implementation of this class
//

class CMSIUIApp : public CWinApp
{
public:
	CMSIUIApp();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMSIUIApp)
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CMSIUIApp)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MSIUI_H__D12B5A44_3F6E_4DCF_9022_E4FB06CE8862__INCLUDED_)

.\Progress.h 文件内容

#if !defined(AFX_PROGRESS_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_)
#define AFX_PROGRESS_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_

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

///
// class CProgress
//
// Author:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
// Copyright ?2000, Yury Goltsman
//
// This code provided "AS IS," without warranty of any kind.
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// version : 1.4
// Gradient Animation added
//
// version : 1.3
// Separated to window independent classes CProgress and CGradient (base)
// Added palette support for 256 colors mode (to CGradient)
// Added shaped style drawing 
//
//
// Old history of CProgressCtrlX:
//
// version : 1.2
// Added support for "Any angle text rotation" 
//   (define PBT_ANY_ANGLE and set font with appropriated angle)
// Added text alignment
// Added possibility to format text (via virtual function FormatText())
//   e.g. you can show percent as decimal fraction instead of integer
//
// version : 1.1
// Added multi-color gradient
// Added filling with brush for background and bar(overrides color settings)
// Added borders attribute
// Added vertical text support
// Added snake mode
// Added reverse mode
// Added dual color for text
// Added text formatting
// Added tied mode for text and rubber bar mode
// Added support for vertical oriented control(PBS_VERTICAL)
// 
// version : 1.0
//

#ifndef UIBITS_API
	#ifdef UIBITS_DLL
		#define  UIBITS_API __declspec(dllexport)
	#else
		#define  UIBITS_API __declspec(dllimport)
	#endif
#endif

#include "Gradient.h"

// To set text alignment styles use ModifyBarStyle()
#define PBS_LEFT                 0x0010L
#define PBS_RIGHT                0x0020L
#define PBS_CENTER               0x0030L
#define PBS_TOP                  0x0040L
#define PBS_BOTTOM               0x0080L
#define PBS_VCENTER              0x00C0L

// To set text format use "SetTextFormat" and "HideText"
#define PBS_SHOW_PERCENT         0x0100L
#define PBS_SHOW_POSITION        0x0200L
#define PBS_SHOW_TEXTONLY        0x0300L
#define PBS_TEXTMASK             0x0300L

// To set this attributes use ModifyBarStyle() or appropriated functions
#define PBS_TIED_TEXT            0x1000L
#define PBS_RUBBER_BAR           0x2000L
#define PBS_REVERSE              0x4000L
#define PBS_SNAKE                0x8000L

/
// class CProgress

class /*UIBITS_API*/ CProgress : public CGradient
{
// Construction
public:
	CProgress();

// Attributes
public:	
	void SetBarBrush(CBrush* pbrBar) { m_pbrBar = pbrBar; }
	CBrush* GetBarBrush() { return m_pbrBar; }

	void SetBkColor(COLORREF clrBk) { m_clrBk = clrBk; }
	COLORREF GetBkColor() { return m_clrBk; }

	void SetBkBrush(CBrush* pbrBk) { m_pbrBk = pbrBk; }
	CBrush* GetBkBrush() { return m_pbrBk; }

	void SetTextColor(COLORREF clrTextOnBar, COLORREF clrTextOnBk = -1) { m_clrTextOnBar = m_clrTextOnBk = clrTextOnBar; if(clrTextOnBk != -1) m_clrTextOnBk = clrTextOnBk;}
	COLORREF GetTextColor() { return m_clrTextOnBar; }
	COLORREF GetTextColorOnBk() { return m_clrTextOnBk; }

	void SetShowPercent(BOOL fShowPercent = TRUE) { SetTextFormat(fShowPercent ? "%d%%" : NULL, PBS_SHOW_PERCENT); }
	BOOL GetShowPercent() { return GetBarStyle()&PBS_SHOW_PERCENT; }

	void SetTextAlign(DWORD dwStyle) {ModifyBarStyle(PBS_CENTER|PBS_VCENTER, dwStyle&(PBS_CENTER|PBS_VCENTER));}
	DWORD GetTextAlign() {return GetBarStyle()&(PBS_CENTER|PBS_VCENTER); }

	void SetTextFormat(LPCTSTR szFormat, DWORD ffFormat = PBS_SHOW_TEXTONLY);
	void HideText() {SetTextFormat(0);}

	void SetText(LPCTSTR lpszText) {m_sText = lpszText;}
	CString GetText() {return m_sText;}

	void SetTiedText(BOOL fTiedText = TRUE) { ModifyBarStyle(fTiedText ? 0 : PBS_TIED_TEXT, fTiedText ? PBS_TIED_TEXT : 0); }
	BOOL GetTiedText() { return GetBarStyle()&PBS_TIED_TEXT; }

	void SetRubberBar(BOOL fRubberBar = TRUE) { ModifyBarStyle(fRubberBar ? 0 : PBS_RUBBER_BAR, fRubberBar ? PBS_RUBBER_BAR : 0); }
	BOOL GetRubberBar() { return GetBarStyle()&PBS_RUBBER_BAR; }

	void SetReverse(BOOL fReverse = TRUE) { ModifyBarStyle(fReverse ? 0 : PBS_REVERSE, fReverse ? PBS_REVERSE : 0); }
	BOOL GetReverse() { return GetBarStyle()&PBS_REVERSE; }

	void SetSnake(BOOL fSnake = TRUE) { ModifyBarStyle(fSnake ? 0 : PBS_SNAKE|PBS_RUBBER_BAR, fSnake ? PBS_SNAKE|PBS_RUBBER_BAR : 0); }
	BOOL GetSnake() { return GetBarStyle()&PBS_SNAKE; }

	void SetSnakeTail(int nTailSize) { m_nTailSize = nTailSize; }
	int  GetSnakeTail() { return m_nTailSize; }

	void SetBorders(const CRect& rcBorders) { m_rcBorders = rcBorders; }
	const CRect& GetBorders() { return m_rcBorders; }

	BOOL SetShape(HRGN hRgn);

	void SetRange(int nLower, int nUpper);
	void GetRange(int& nLower, int& nUpper) {nLower = m_nLower; nUpper = m_nUpper;}

	int GetPos() {return m_nPos;}
	int SetPos(int nPos);

	int OffsetPos(int nIncrement);

	int SetStep(int nStep);

	void SetFont(CFont* pFont) {m_pFont = pFont;}
	CFont* GetFont() {return m_pFont;}

	virtual DWORD GetBarStyle() {return m_dwStyle;}
	virtual void ModifyBarStyle(DWORD dwRemove, DWORD dwAdd) {m_dwStyle &= ~dwRemove; m_dwStyle |= dwAdd;}

	void Animate(int nStep) {m_nAnimPos += nStep; m_nAnimPos %= int((m_nUpper - m_nLower)*GetStretchGradient());}
	void ResetAnimation() {m_nAnimPos = 0;}

// Operations
public:
	int StepIt();
	void Draw(CDC* pDC, CRect rcDraw, BOOL fSkipDCCache = FALSE);
	
// Implementation
public:
	virtual ~CProgress(){}

protected:
	struct CDrawInfo
	{
		CDC *pDC;
		DWORD dwStyle;
		CRect rcClient;
		int nCurPos;
		int nLower;
		int nUpper;
	};
	
	virtual void DrawText(const CDrawInfo& info, const CRect &rcMax, const CRect &rcGrad);
	virtual void DrawClippedText(const CDrawInfo& info, const CRect& rcClip, CString& sText, const CPoint& ptWndOrg);
	CRect ConvertToReal(const CDrawInfo& info, const CRect& rcVirt);
	virtual BOOL SetSnakePos(int nNewPos, BOOL fIncrement = FALSE);
	virtual CString FormatText(const CDrawInfo& info, CString sFormat, float nValue);
	virtual float CalcPos(const CDrawInfo& info);
	void UpdatePos(int nNewPos, BOOL fForse = FALSE);
	virtual BOOL OnPosChanging(int nOldPos, int nNewPos) {return TRUE;}
	virtual void OnPosChanged(int nNewPos) {}

	// color atributes
	CBrush* m_pbrBar; 
	COLORREF m_clrBk;
	CBrush* m_pbrBk;
	COLORREF m_clrTextOnBar;
	COLORREF m_clrTextOnBk;

	// snake/progress attributes
	int m_nTail;
	int m_nTailSize;
	int m_nStep;
	int m_nLower;
	int m_nUpper;

	CRect m_rcBorders;
	CString m_sText;
	CFont* m_pFont;
	DWORD m_dwStyle;
	CRgn m_rgnShape;
private:
	int m_nPos;
	int m_nAnimPos;
};

/

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PROGRESS_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_)
.\ProgressCtrlX.h 文件内容

#if !defined(AFX_PROGRESSCTRLX_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_)
#define AFX_PROGRESSCTRLX_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_

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

///
// class CProgressCtrlX
//
// Author:  Yury Goltsman
// email:   ygprg@go.to
// page:    http://go.to/ygprg
// Copyright ?2000, Yury Goltsman
//
// This code provided "AS IS," without warranty of any kind.
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
// version : 1.4
// Gradient Animation added
//
// version : 1.3
// Most code separated to window independent base classes 
//    (maximum compatibility with previous version)
// Added support for ToolTips
// Added self running snake
//
// version : 1.2
// Added support for "Any angle text rotation" 
//   (define PBT_ANY_ANGLE and set font with appropriated angle)
// Added text alignment
// Added possibility to format text (via virtual function FormatText())
//   e.g. you can show percent as decimal fraction instead of integer
//
// version : 1.1
// Added multi-color gradient
// Added filling with brush for background and bar(overrides color settings)
// Added borders attribute
// Added vertical text support
// Added snake mode
// Added reverse mode
// Added dual color for text
// Added text formatting
// Added tied mode for text and rubber bar mode
// Added support for vertical oriented control(PBS_VERTICAL)
// 
// version : 1.0
//

#ifndef UIBITS_API
	#ifdef UIBITS_DLL
		#define  UIBITS_API __declspec(dllexport)
	#else
		#define  UIBITS_API __declspec(dllimport)
	#endif
#endif

#include "Progress.h"

/
// class CProgressCtrlX

class /*UIBITS_API*/ CProgressCtrlX : public CProgressCtrl, public CProgress
{
// Construction
public:
	CProgressCtrlX();

// Attributes
public:
	void SetTooltipFormat (LPCTSTR lpszToolTipText, DWORD fFormat = PBS_SHOW_TEXTONLY);
	LPCTSTR GetTooltipText() { return m_sToolTipText;}
	void HideTooltip() {SetTooltipFormat(0);}

	int SetPos(int nPos) {int res = CProgress::SetPos(nPos); Invalidate(); return res;}
	int GetPos() {return CProgress::GetPos();}
	
	int SetStep(int nStep){int res = CProgress::SetStep(nStep); Invalidate(); return res;}

	void SetRange(int nLower, int nUpper) {CProgress::SetRange(nLower, nUpper); Invalidate();}
	void GetRange(int& nLower, int& nUpper) {CProgress::GetRange(nLower, nUpper);}

	int OffsetPos(int nIncrement) {int res = CProgress::OffsetPos(nIncrement); Invalidate(); return res;}

	void SetFont(CFont* pFont) {CProgress::SetFont(pFont); Invalidate();}
	CFont* GetFont() {return CProgress::GetFont();}

	virtual DWORD GetBarStyle() {return CProgressCtrl::GetStyle();}
	virtual void ModifyBarStyle(DWORD dwRemove, DWORD dwAdd) {CProgressCtrl::ModifyStyle(dwRemove, dwAdd); Invalidate();}
// Operations
public:
	int StepIt() {int res = CProgress::StepIt(); Invalidate(); return res;}
	
	void RunSnake(int nMsPerStep) {ASSERT(GetSnake()); StopSnake(); SetTimer(SnakeTimer, nMsPerStep, NULL);}
	void StopSnake() {KillTimer(SnakeTimer);}

	void RunAnimation(int nMsPerStep, int nStep) {m_nAnimStep = nStep; StopAnimation(); SetTimer(AnimationTimer, nMsPerStep, NULL);}
	void StopAnimation() {KillTimer(AnimationTimer);}
	static bool s_bSmooth;
	static bool s_bIsXP;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CProgressCtrlX)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CProgressCtrlX(){}

	// Generated message map functions
protected:
	enum {SnakeTimer = 11, AnimationTimer = 12};
	CToolTipCtrl m_wndToolTip;
	CString m_sToolTipText;
	DWORD m_fToolTipFormat;
	int m_nAnimStep;
	virtual void OnPosChanged(int nNewPos){ UpdateTooltipText(nNewPos);}
	void UpdateTooltipText(int nPos);

	//{{AFX_MSG(CProgressCtrlX)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg LRESULT OnSetBarColor(WPARAM, LPARAM);
	afx_msg LRESULT OnSetBkColor(WPARAM, LPARAM);
	afx_msg LRESULT OnGetPos(WPARAM, LPARAM);
	afx_msg LRESULT OnSetPos(WPARAM, LPARAM);
	afx_msg LRESULT OnDeltaPos(WPARAM, LPARAM);
	afx_msg LRESULT OnStepIt(WPARAM, LPARAM);
	afx_msg LRESULT OnSetStep(WPARAM, LPARAM);
	afx_msg LRESULT OnGetRange(WPARAM, LPARAM);
	afx_msg LRESULT OnSetRange(WPARAM, LPARAM);
	afx_msg LRESULT OnSetRange32(WPARAM, LPARAM);
	afx_msg LRESULT OnSetText(WPARAM, LPARAM);
	afx_msg LRESULT OnGetText(WPARAM, LPARAM);
	afx_msg LRESULT OnGetTextLength(WPARAM, LPARAM);
	afx_msg LRESULT OnGetFont(WPARAM, LPARAM);
	afx_msg LRESULT OnSetFont(WPARAM, LPARAM);
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PROGRESSCTRLX_H__F26E8924_D1C1_11D3_B261_00104BB13A66__INCLUDED_)

.\Resource.h 文件内容

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by MSIUI.rc
//
#define IDS_CANCEL                      1
#define IDS_SETUP                       2
#define IDS_OFFSET                      3
#define IDS_LANG                        4
#define IDS_INSTALLING                  5
#define IDS_err1603                     6
#define IDS_err1618                     8
#define IDS_err2                        9
#define IDS_err1605                     10
#define IDS_err1619                     11
#define IDS_err1601                     12
#define IDS_INITIATION                  13
#define IDS_err1620                     14
#define IDS_err1621                     15
#define IDC_TOTAL                       1000
#define IDC_NUMBER                      1000
#define IDC_PRGTOTAL                    1001
#define IDC_MSINAME                     1001
#define IDC_SUBTOTAL                    1002
#define IDC_PRGSUB                      1003
#define IDC_DESCR                       1004
#define IDC_INSTALL                     1005
#define IDC_DONE                        1006
#define IDC_CANCEL                      1007
#define IDD_MAIN                        1008
#define IDI_U8                          1009

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        1010
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1002
#define _APS_NEXT_SYMED_VALUE           1000
#endif
#endif

.\StdAfx.h 文件内容

// 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__A3D8F67D_5BB0_427C_8ED9_CA8C6762669E__INCLUDED_)
#define AFX_STDAFX_H__A3D8F67D_5BB0_427C_8ED9_CA8C6762669E__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

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h>         // MFC OLE classes
#include <afxodlgs.h>       // MFC OLE dialog classes
#include <afxdisp.h>        // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT


#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h>			// MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT

#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h>			// MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT

#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 <Msi.h>

#include "resource.h"

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__A3D8F67D_5BB0_427C_8ED9_CA8C6762669E__INCLUDED_)



.\res\MSIUI.rc2 文件内容


//
// MSIUI.RC2 - resources Microsoft Visual C++ does not edit directly
//

#ifdef APSTUDIO_INVOKED
	#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED


/
// Add manually edited resources here...

/





MSIUI.rc 文件内容   中文

//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/
#undef APSTUDIO_READONLY_SYMBOLS

/
// Chinese (P.R.C.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\MSIUI.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/
//
// Dialog
//

IDD_MAIN DIALOGEX 0, 0, 306, 74
STYLE DS_CONTROL | WS_CHILD
FONT 8, "Tahoma"
BEGIN
    CONTROL         "Progress1",IDC_PRGSUB,"msctls_progress32",0x0,7,24,292,
                    12,WS_EX_TRANSPARENT
    LTEXT           "description",IDC_DESCR,7,43,223,23,0,WS_EX_TRANSPARENT
    PUSHBUTTON      "退出安装",IDC_CANCEL,235,56,64,12,BS_FLAT
    RTEXT           "",IDC_NUMBER,206,9,85,9,0,WS_EX_TRANSPARENT
    LTEXT           "Static",IDC_MSINAME,13,9,177,11,0,WS_EX_TRANSPARENT
    ICON            1009,IDC_STATIC,209,2,20,20,SS_REALSIZEIMAGE,
                    WS_EX_TRANSPARENT
END


/
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_MAIN, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 299
        BOTTOMMARGIN, 68
    END
END
#endif    // APSTUDIO_INVOKED


/
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_CANCEL              "真的要取消安装吗?"
    IDS_SETUP               "安装"
    IDS_OFFSET              "16"
    IDS_LANG                "CN"
    IDS_INSTALLING          "不可能出现"
    IDS_err1603             "安装或卸载MSI安装包发生严重错误"
    IDS_err1618             "当前系统存在另一个MSI安装或卸载进程"
    IDS_err2                "无法读取MSI安装包,请确认安装路径"
    IDS_err1605             "没有MSI包安装信息"
    IDS_err1619             "无法读取MSI安装包,请检查安装包是否完整或者安装权限受限"
    IDS_err1601             "Windows Installer服务没有启动,请启动后重试"
    IDS_INITIATION          "正在切换安装产品模块,请等待......"
    IDS_err1620             "磁盘空间不足"
    IDS_err1621             "请关闭或暂时停用杀毒软件,系杀毒软件扫描占用安装文件导致。"
END

#endif    // Chinese (P.R.C.) resources
/


/
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifndef _MAC
/
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "\0"
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "MSIUI DLL\0"
            VALUE "FileVersion", "1, 0, 0, 1\0"
            VALUE "InternalName", "MSIUI\0"
            VALUE "LegalCopyright", "Copyright (C) 2007\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "MSIUI.DLL\0"
            VALUE "PrivateBuild", "\0"
            VALUE "ProductName", "MSIUI Dynamic Link Library\0"
            VALUE "ProductVersion", "1, 0, 0, 1\0"
            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // !_MAC

#endif    // English (U.S.) resources
/



#ifndef APSTUDIO_INVOKED
/
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\MSIUI.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"         // Standard components
#endif

/
#endif    // not APSTUDIO_INVOKED



MSIUI.rc 文件内容   繁体



//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/
#undef APSTUDIO_READONLY_SYMBOLS

/
// Chinese (P.R.C.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\MSIUI.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/
//
// Dialog
//

IDD_MAIN DIALOGEX 0, 0, 323, 74
STYLE DS_CONTROL | WS_CHILD
FONT 8, "Tahoma", 0, 0, 0x1
BEGIN
    CONTROL         "Progress1",IDC_PRGSUB,"msctls_progress32",WS_BORDER,7,
                    24,311,13,WS_EX_TRANSPARENT
    LTEXT           "description",IDC_DESCR,7,43,223,23,0,WS_EX_TRANSPARENT
    PUSHBUTTON      "Exit Setup",IDC_CANCEL,254,56,64,12,BS_FLAT
    RTEXT           "",IDC_NUMBER,225,9,93,9,0,WS_EX_TRANSPARENT
    LTEXT           "Static",IDC_MSINAME,13,9,152,11,0,WS_EX_TRANSPARENT
    ICON            1009,IDC_STATIC,181,3,21,20,SS_REALSIZEIMAGE | NOT 
                    WS_VISIBLE,WS_EX_TRANSPARENT
END


/
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_MAIN, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 318
        BOTTOMMARGIN, 69
    END
END
#endif    // APSTUDIO_INVOKED


/
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_CANCEL              "Do you want to exit setup?"
    IDS_SETUP               "Setup"
    IDS_OFFSET              "20"
    IDS_LANG                "EN"
    IDS_INSTALLING          "Installing,Please Wait..."
    IDS_err1603             "Fatal error during installation."
    IDS_err1618             "Another installation is already in progress. Complete that installation before proceeding with this install."
    IDS_err2                "This installation package could not be opened. Contact the application vendor to verify the path."
    IDS_err1605             "This action is only valid for products that are currently installed."
    IDS_err1619             "This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
    IDS_err1601             "The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered"
    IDS_INITIATION          "Switching the Installer pack,Please waitting..."
    IDS_err1620             "No Eough Disk Place"
    IDS_err1621             "Please shut down or temporarily disable antivirus software, antivirus software to scan occupied system installation files to."
END

#endif    // Chinese (P.R.C.) resources
/


/
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifndef _MAC
/
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "\0"
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "MSIUI DLL\0"
            VALUE "FileVersion", "1, 0, 0, 1\0"
            VALUE "InternalName", "MSIUI\0"
            VALUE "LegalCopyright", "Copyright (C) 2007\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "MSIUI.DLL\0"
            VALUE "PrivateBuild", "\0"
            VALUE "ProductName", "MSIUI Dynamic Link Library\0"
            VALUE "ProductVersion", "1, 0, 0, 1\0"
            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // !_MAC

#endif    // English (U.S.) resources
/



#ifndef APSTUDIO_INVOKED
/
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\MSIUI.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"         // Standard components
#endif

/
#endif    // not APSTUDIO_INVOKED


MSIUI.rc 文件内容   英文




//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/
#undef APSTUDIO_READONLY_SYMBOLS

/
// Chinese (P.R.C.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\MSIUI.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/
//
// Dialog
//

IDD_MAIN DIALOGEX 0, 0, 323, 74
STYLE DS_CONTROL | WS_CHILD
FONT 8, "Tahoma", 0, 0, 0x1
BEGIN
    CONTROL         "Progress1",IDC_PRGSUB,"msctls_progress32",WS_BORDER,7,
                    24,311,13,WS_EX_TRANSPARENT
    LTEXT           "description",IDC_DESCR,7,43,223,23,0,WS_EX_TRANSPARENT
    PUSHBUTTON      "Exit Setup",IDC_CANCEL,254,56,64,12,BS_FLAT
    RTEXT           "",IDC_NUMBER,225,9,93,9,0,WS_EX_TRANSPARENT
    LTEXT           "Static",IDC_MSINAME,13,9,152,11,0,WS_EX_TRANSPARENT
    ICON            1009,IDC_STATIC,181,3,21,20,SS_REALSIZEIMAGE | NOT 
                    WS_VISIBLE,WS_EX_TRANSPARENT
END


/
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_MAIN, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 318
        BOTTOMMARGIN, 69
    END
END
#endif    // APSTUDIO_INVOKED


/
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_CANCEL              "Do you want to exit setup?"
    IDS_SETUP               "Setup"
    IDS_OFFSET              "20"
    IDS_LANG                "EN"
    IDS_INSTALLING          "Installing,Please Wait..."
    IDS_err1603             "Fatal error during installation."
    IDS_err1618             "Another installation is already in progress. Complete that installation before proceeding with this install."
    IDS_err2                "This installation package could not be opened. Contact the application vendor to verify the path."
    IDS_err1605             "This action is only valid for products that are currently installed."
    IDS_err1619             "This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
    IDS_err1601             "The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered"
    IDS_INITIATION          "Switching the Installer pack,Please waitting..."
    IDS_err1620             "No Eough Disk Place"
    IDS_err1621             "Please shut down or temporarily disable antivirus software, antivirus software to scan occupied system installation files to."
END

#endif    // Chinese (P.R.C.) resources
/


/
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifndef _MAC
/
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "\0"
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "MSIUI DLL\0"
            VALUE "FileVersion", "1, 0, 0, 1\0"
            VALUE "InternalName", "MSIUI\0"
            VALUE "LegalCopyright", "Copyright (C) 2007\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "MSIUI.DLL\0"
            VALUE "PrivateBuild", "\0"
            VALUE "ProductName", "MSIUI Dynamic Link Library\0"
            VALUE "ProductVersion", "1, 0, 0, 1\0"
            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // !_MAC

#endif    // English (U.S.) resources
/



#ifndef APSTUDIO_INVOKED
/
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\MSIUI.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"         // Standard components
#endif

/
#endif    // not APSTUDIO_INVOKED










  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值