|
// (c) 2001 Microsoft Corporation
function OnFinish(selProj, selObj)
{
try
{
var strProjectPath = wizard.FindSymbol("PROJECT_PATH");
var strProjectName = wizard.FindSymbol("PROJECT_NAME");
selProj = CreateProject(strProjectName, strProjectPath);
AddCommonConfig(selProj, strProjectName);
AddSpecificConfig(selProj, strProjectName);
selProj.Object.keyword = "MFCDLLProj";
SetupFilters(selProj);
var InfFile = CreateInfFile();
AddFilesToProject(selProj, strProjectName, InfFile);
SetCommonPchSettings(selProj);
InfFile.Delete();
AddDefaultManagedConfigs2(selProj);
AddReferencesForWinForm(selProj);
selProj.Object.Save();
}
catch(e)
{
if (e.description.length != 0)
SetErrorInfo(e);
return e.number
}
}
function SetFileProperties(projfile, strName)
{
if (strName == "MainCtrl.h")
projfile.Object.FileType = eFileTypeCppControl;
if (strName == "MainCtrl.resX")
{
var strNS = wizard.FindSymbol("PROJECT_NAME");
var strResFileName = "$(IntDir)/" + strNS + "." + strNS + "Control.resources";
SetResourceFileName(projfile, strResFileName);
}
return false;
}
function AddDefaultManagedConfigs2(proj)
{
try
{
var config = proj.Object.Configurations("Debug");
config.ManagedExtensions = true;
var CLTool = config.Tools("VCCLCompilerTool");
CLTool.WarningLevel = warningLevel_3;
CLTool.MinimalRebuild = false;
CLTool.DebugInformationFormat = debugEnabled;
CLTool.Optimization = optimizeDisabled;
CLTool.BasicRuntimeChecks = runtimeBasicCheckNone;
//CLTool.PreprocessorDefinitions = GetPlatformDefine(config) + "_DEBUG";
//CLTool.RuntimeLibrary = rtMultiThreadedDebug;
var LinkTool = config.Tools("VCLinkerTool");
LinkTool.GenerateDebugInformation = true;
LinkTool.LinkIncremental = linkIncrementalYes;
LinkTool.AssemblyDebug = linkAssemblyDebugFull;
//LinkTool = config.Tools("VCLinkerTool");
LinkTool.ForceSymbolReferences = "__DllMainCRTStartup@12";
LinkTool.AdditionalDependencies = "mscoree.lib";
LinkTool.AdditionalDependencies += " MfcDotNetExtLibD.lib";
LinkTool.AdditionalOptions = "/noentry";
//LinkTool = config.Tools("VCMidlTool");
config = proj.Object.Configurations.Item("Release");
config.ManagedExtensions = true;
CLTool = config.Tools("VCCLCompilerTool");
CLTool.WarningLevel = warningLevel_3;
CLTool.MinimalRebuild = false;
//CLTool.PreprocessorDefinitions = GetPlatformDefine(config) + "NDEBUG";
//CLTool.RuntimeLibrary = rtMultiThreaded;
CLTool.DebugInformationFormat = debugEnabled;
LinkTool = config.Tools("VCLinkerTool");
LinkTool.GenerateDebugInformation = true;
LinkTool.LinkIncremental = linkIncrementalNo;
//LinkTool = config.Tools("VCLibrarianTool");
LinkTool.ForceSymbolReferences = "__DllMainCRTStartup@12";
LinkTool.AdditionalDependencies = "mscoree.lib";
LinkTool.AdditionalDependencies += " MfcDotNetExtLib.lib";
LinkTool.AdditionalOptions = "/noentry";
proj.Object.keyword = "ManagedCProj";
}
catch(e)
{
throw e;
}
}
function GetTargetName(strName, strProjectName, strResPath, strHelpPath)
{
try
{
var strTarget = strName;
if (strName.substr(0, 4) == "root")
{
if (strName == "root.ico" || strName == "root.rc2")
{
var strSafeProjectName = wizard.FindSymbol("SAFE_PROJECT_NAME");
strSafeTarget = strSafeProjectName + strName.substr(4);
strTarget = strResPath + "\\" + strSafeTarget;
}
else
{
strTarget = strProjectName + strName.substr(4);
}
return strTarget;
}
if (strName.substr(0, 12) == "mfcDocObject")
{
var strExtension = strName.substr(12);
strTarget = strProjectName + "DocObject" + strExtension;
return strTarget;
}
var strSafeProjectName = wizard.FindSymbol("SAFE_PROJECT_NAME");
switch (strName)
{
case "doc.h":
strTarget = strSafeProjectName + "Doc.h";
break;
case "doc.cpp":
strTarget = strSafeProjectName + "Doc.cpp";
break;
case "DotNetMfcView.h":
strTarget = strSafeProjectName + "View.h";
break;
case "DotNetMfcView.cpp":
strTarget = strSafeProjectName + "View.cpp";
break;
case "readme.txt":
strTarget = "ReadMe.txt";
break;
case "all.rc":
case "dlgall.rc":
strTarget = strProjectName + ".rc";
break;
case "dlgres.h":
case "resource.h":
strTarget = "Resource.h";
break;
default:
break;
}
return strTarget;
}
catch(e)
{
throw e;
}
}
function AddSpecificConfig(proj, strProjectName)
{
try
{
var bAutomation = wizard.FindSymbol("AUTOMATION");
var bRegular = wizard.FindSymbol("DLL_TYPE_REGULAR");
var bRegularStatic = wizard.FindSymbol("DLL_TYPE_REGULAR_STATIC");
var config = proj.Object.Configurations("Debug");
config.ConfigurationType = typeDynamicLibrary;
config.CharacterSet = charSetMBCS;
var CLTool = config.Tools("VCCLCompilerTool");
var strDefines = GetPlatformDefine(config);
strDefines += "_WINDOWS;_DEBUG";
if (bRegular || bRegularStatic)
strDefines += ";_USRDLL";
else
strDefines += ";_AFXEXT";
if (bRegularStatic)
{
config.UseOfMFC = useMfcStatic;
CLTool.RuntimeLibrary = rtMultiThreadedDebug;
}
else
{
config.UseOfMFC = useMfcDynamic;
CLTool.RuntimeLibrary = rtMultiThreadedDebugDLL;
}
CLTool.PreprocessorDefinitions = strDefines;
CLTool.TreatWChar_tAsBuiltInType = true;
CLTool.DebugInformationFormat = debugEditAndContinue;
var MidlTool = config.Tools("VCMidlTool");
MidlTool.MkTypLibCompatible = false;
MidlTool.PreprocessorDefinitions = "_DEBUG";
if (bAutomation)
{
MidlTool.TypeLibraryName = "$(IntDir)/" + "$(ProjectName).tlb";
if (IsPlatformWin32(config))
MidlTool.TargetEnvironment = midlTargetWin32;
}
var RCTool = config.Tools("VCResourceCompilerTool");
RCTool.Culture = wizard.FindSymbol("LCID");
RCTool.PreprocessorDefinitions = "_DEBUG";
RCTool.AdditionalIncludeDirectories = "$(IntDir)";
var LinkTool = config.Tools("VCLinkerTool");
LinkTool.LinkIncremental = linkIncrementalYes;
LinkTool.GenerateDebugInformation = true;
var strDefFile = ".\\" + strProjectName + ".def";
LinkTool.ModuleDefinitionFile = strDefFile;
LinkTool.OutputFile = "$(OutDir)/" + strProjectName + ".dll";
LinkTool.ImportLibrary = "$(OutDir)/" + strProjectName + ".lib";
if (bAutomation)
{
var PostBuildTool = config.Tools("VCPostBuildEventTool");
var L_PerformingRegistration1_Text = "Performing registration";
PostBuildTool.Description = L_PerformingRegistration1_Text;
PostBuildTool.CommandLine = "regsvr32 /s /c \"$(TargetPath)\"";
}
config = proj.Object.Configurations("Release");
config.ConfigurationType = typeDynamicLibrary;
config.CharacterSet = charSetMBCS;
CLTool = config.Tools("VCCLCompilerTool");
strDefines = GetPlatformDefine(config);
strDefines += "_WINDOWS;NDEBUG";
if (bRegular || bRegularStatic)
strDefines += ";_USRDLL";
else
strDefines += ";_AFXEXT";
if (bRegularStatic)
{
config.UseOfMFC = useMfcStatic;
CLTool.RuntimeLibrary = rtMultiThreaded;
}
else
{
config.UseOfMFC = useMfcDynamic;
CLTool.RuntimeLibrary = rtMultiThreadedDLL;
}
CLTool.PreprocessorDefinitions = strDefines;
CLTool.TreatWChar_tAsBuiltInType = true;
CLTool.DebugInformationFormat = debugEnabled;
MidlTool = config.Tools("VCMidlTool");
MidlTool.MkTypLibCompatible = false;
MidlTool.PreprocessorDefinitions = "NDEBUG";
if (bAutomation)
{
MidlTool.TypeLibraryName = "$(IntDir)/" + "$(ProjectName).tlb";
if (IsPlatformWin32(config))
MidlTool.TargetEnvironment = midlTargetWin32;
}
RCTool = config.Tools("VCResourceCompilerTool");
RCTool.Culture = wizard.FindSymbol("LCID");
RCTool.PreprocessorDefinitions = "NDEBUG";
RCTool.AdditionalIncludeDirectories = "$(IntDir)";
LinkTool = config.Tools("VCLinkerTool");
var strDefFile = ".\\" + strProjectName + ".def";
LinkTool.ModuleDefinitionFile = strDefFile;
LinkTool.OutputFile = "$(OutDir)/" + strProjectName + ".dll";
LinkTool.ImportLibrary = "$(OutDir)/" + strProjectName + ".lib";
LinkTool.GenerateDebugInformation = true;
LinkTool.LinkIncremental = linkIncrementalNo;
if (bAutomation)
{
var PostBuildTool = config.Tools("VCPostBuildEventTool");
var L_PerformingRegistration2_Text = "Performing registration";
PostBuildTool.Description = L_PerformingRegistration2_Text;
PostBuildTool.CommandLine = "regsvr32 /s /c \"$(TargetPath)\"";
}
}
catch(e)
{
throw e;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here