⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ktsiuspwizardaw.cpp

📁 在驱动开发时
💻 CPP
字号:
// ktSIUSPWizardaw.cpp : implementation file
//

#include "stdafx.h"
#include "ktSIUSPWizard.h"
#include "ktSIUSPWizardaw.h"
#include "chooser.h"

#include "Atlbase.h"

#ifdef _PSEUDO_DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// This is called immediately after the custom AppWizard is loaded.  Initialize
//  the state of the custom AppWizard here.
void CKtSIUSPWizardAppWiz::InitCustomAppWiz()
{
	// Create a new dialog chooser; CDialogChooser's constructor initializes
	//  its internal array with pointers to the steps.
	m_pChooser = new CDialogChooser;

	// Set the maximum number of steps.
	SetNumberOfSteps(LAST_DLG);

	// Inform AppWizard that we're making a DLL.
	m_Dictionary[_T("PROJTYPE_DLL")] = _T("1");

	// TODO: Add any other custom AppWizard-wide initialization here.
}

// This is called just before the custom AppWizard is unloaded.
void CKtSIUSPWizardAppWiz::ExitCustomAppWiz()
{
	// Deallocate memory used for the dialog chooser
	ASSERT(m_pChooser != NULL);
	delete m_pChooser;
	m_pChooser = NULL;

	// TODO: Add code here to deallocate resources used by the custom AppWizard
}

// This is called when the user clicks "Create..." on the New Project dialog
//  or "Next" on one of the custom AppWizard's steps.
CAppWizStepDlg* CKtSIUSPWizardAppWiz::Next(CAppWizStepDlg* pDlg)
{
	// Delegate to the dialog chooser
	return m_pChooser->Next(pDlg);
}

// This is called when the user clicks "Back" on one of the custom
//  AppWizard's steps.
CAppWizStepDlg* CKtSIUSPWizardAppWiz::Back(CAppWizStepDlg* pDlg)
{
	// Delegate to the dialog chooser
	return m_pChooser->Back(pDlg);
}

void CKtSIUSPWizardAppWiz::CustomizeProject(IBuildProject* pProject)
{
	// TODO: Add code here to customize the project.  If you don't wish
	//  to customize project, you may remove this virtual override.
	
	// This is called immediately after the default Debug and Release
	//  configurations have been created for each platform.  You may customize
	//  existing configurations on this project by using the methods
	//  of IBuildProject and IConfiguration such as AddToolSettings,
	//  RemoveToolSettings, and AddCustomBuildStep. These are documented in
	//  the Developer Studio object model documentation.

	// WARNING!!  IBuildProject and all interfaces you can get from it are OLE
	//  COM interfaces.  You must be careful to release all new interfaces
	//  you acquire.  In accordance with the standard rules of COM, you must
	//  NOT release pProject, unless you explicitly AddRef it, since pProject
	//  is passed as an "in" parameter to this function.  See the documentation
	//  on CCustomAppWiz::CustomizeProject for more information.
	CComPtr<IConfigurations> pConfigs;
	HRESULT hr=pProject->get_Configurations(&pConfigs);
	if(FAILED(hr))
	{
		AfxMessageBox("An error occurred while obtaining the IConfigurations interface pointer");
		return;
	}
	CComPtr<IConfiguration> pConfig;
	CComVariant index;
	VARIANT m_var = {0};
	CComBSTR Name;
	CString text;
//	CString output;

	long Count=0;
	pConfigs->get_Count(&Count);

	// Iterate through all the configurations of the project.
	for(int i=1; i <= Count; i++)
	{
		index=i;
		hr=pConfigs->Item(index, &pConfig);
		if(FAILED(hr))
		{
			AfxMessageBox("An error occurred while obtaining the IConfiguration pointer");
			return;
		}
/*		pConfig->get_Name(&Name);
		text = Name;

		if (text.Find("Debug") == -1)
			output = "Release";
		else
			output = "Debug";

		text.Format("/out:\"%s/%s.exe\"",output,m_Dictionary["Root"]);
		pConfig->AddToolSettings(L"link.exe", text.AllocSysString(), m_var);

		pConfig->AddToolSettings(L"mfc", L"0", m_var);
		pConfig->AddToolSettings(L"link.exe", L"/subsystem:console", m_var);
		pConfig->AddToolSettings(L"link.exe", L"/incremental:yes", m_var);
		pConfig->AddToolSettings(L"link.exe", L"/machine:I386", m_var);

		// Change the preprocessor definitions.
		pConfig->AddToolSettings(L"cl.exe", L"/nologo", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/MLd", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/W3", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/Gm", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/ZI", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/Od", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/D \"WIN32\"", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/D \"_DEBUG\"", m_var);
		pConfig->AddToolSettings(L"cl.exe", L"/D \"_CONSOLE\"", m_var);
*/
		// Change the libraries.
		pConfig->get_Name(&Name);
		text = Name;

		pConfig->AddToolSettings(L"link.exe", L"ktLog.lib", m_var);
		if (text.Find("Debug") == -1)
		{
//			output = "Release";
			pConfig->AddToolSettings(L"link.exe", L"ktSIUSPI.lib", m_var);
			pConfig->AddToolSettings(L"link.exe", L"ktRegister.lib", m_var);
		}
		else
		{
//			output = "Debug";
			pConfig->AddToolSettings(L"link.exe", L"ktSIUSPID.lib", m_var);
			pConfig->AddToolSettings(L"link.exe", L"ktRegisterD.lib", m_var);
		}

		pConfig=NULL;
	}
	pConfigs=NULL;	
}


// Here we define one instance of the CKtSIUSPWizardAppWiz class.  You can access
//  m_Dictionary and any other public members of this class through the
//  global KtSIUSPWizardaw.
CKtSIUSPWizardAppWiz KtSIUSPWizardaw;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -