functiononfinish (selproj, selobj) {Try { varStrprojectpath = Wizard. FindSymbol (' Project_path '); varStrprojectname = Wizard. FindSymbol (' Project_Name '); Selproj=Createcustomproject (Strprojectname, Strprojectpath); Addconfig (Selproj, strprojectname); Addfilters (selproj); varInfFile =Createcustominffile (); Addfilestocustomproj (Selproj, Strprojectname, Strprojectpath, InfFile); Pchsettings (selproj); Inffile.delete (); SelProj.Object.Save (); } Catch(e) {if(E.description.length! = 0) SetErrorInfo (e); returnE.number}}functionCreatecustomproject (Strprojectname, Strprojectpath) {Try { varStrprojtemplatepath = Wizard. FindSymbol (' Project_template_path '); varStrprojtemplate = ' '; Strprojtemplate= Strprojtemplatepath + ' \\default.vcproj '; varSolution =DTE. solution; varStrsolutionname = ""; if(Wizard.) FindSymbol ("Close_solution") ) {solution.close (); Strsolutionname= Wizard. FindSymbol ("Vs_solution_name"); if(strsolutionname.length) {varStrsolutionpath = strprojectpath.substr (0, Strprojectpath.length-strprojectname.length); Solution.Create (Strsolutionpath, strsolutionname); } } varStrprojectnamewithext = ' '; Strprojectnamewithext= Strprojectname + '. vcproj '; varOtarget = Wizard. FindSymbol ("TARGET"); varprj; if(Wizard.) FindSymbol ("wizard_type") = = Vswizardaddsubproject)//Vswizardaddsubproject { varPrjitem =otarget.addfromtemplate (Strprojtemplate, Strprojectnamewithext); PRJ=Prjitem.subproject; } Else{prj=otarget.addfromtemplate (Strprojtemplate, Strprojectpath, Strprojectnamewithext); } varFxtarget = Wizard. FindSymbol ("Target_framework_version"); if(Fxtarget! =NULL&& fxtarget! = "") {Fxtarget= Fxtarget.split ('. ', 2); if(Fxtarget.length = = 2) prj. Object.targetframeworkversion= parseint (fxtarget[0]) * 0x10000 + parseint (fxtarget[1]) } returnprj; } Catch(e) {Throwe; }}functionAddfilters (proj) {Try { //to add a folder to a project//var strsrcfilter = Wizard. FindSymbol (' Source_filter ');//var group = proj. Object.addfilter (' source file ');//Group. Filter = Strsrcfilter;Proj. Object.addfilter (' source file '). Filter = ' Cpp;c;def '; Proj. Object.addfilter (' Header file '). Filter = ' Hpp;h '; Proj. Object.addfilter (' Resource file '). Filter = ' Ico;rc;bin '; } Catch(e) {Throwe; }}functionAddconfig (proj, strprojectname) {Try { varConfig = proj. Object.configurations (' Debug '); Config. CharacterSet=CharSetUnicode; Config. ConfigurationType=typedynamiclibrary; Config. IntermediateDirectory= ' $ (configurationname) '; Config. OutputDirectory= ' $ (configurationname) '; varCltool = config. Tools (' VCCLCompilerTool '); //TODO: Adding Compiler SettingsCltool.runtimelibrary =Rtmultithreadeddebugdll; varStrdefines =cltool.preprocessordefinitions; if(Strdefines! = "") Strdefines + = ";"; Strdefines+=getplatformdefine (config); Strdefines+ = "_DEBUG"; Strdefines+ = "; _windows;_usrdll;"; varStrexports = Strprojectname.tostring (). toUpperCase () + "_exports"; Strdefines+=Strexports; Cltool.preprocessordefinitions=Strdefines; Cltool.debuginformationformat=debugeditandcontinue; varLinkTool = config. Tools (' VCLinkerTool '); //TODO: Add linker settingsLinktool.moduledefinitionfile = strprojectname+ ". def"; Linktool.generatedebuginformation=true; Linktool.subsystem=subsystemwindows; Config= proj. Object.configurations (' Release '); Config. IntermediateDirectory= ' $ (configurationname) '; Config. OutputDirectory= ' $ (configurationname) '; Config. CharacterSet=CharSetUnicode; Config. ConfigurationType=typedynamiclibrary; varCltool = config. Tools (' VCCLCompilerTool '); //TODO: Adding Compiler SettingsCltool.runtimelibrary =Rtmultithreadeddll; varStrdefines =cltool.preprocessordefinitions; if(Strdefines! = "") Strdefines + = ";"; Strdefines+=getplatformdefine (config); Strdefines+ = "Ndebug"Strdefines+ = "; _windows;_usrdll;"; varStrexports = Strprojectname.tostring (). toUpperCase () + "_exports"; Strdefines+=Strexports; Cltool.preprocessordefinitions=Strdefines; Cltool.debuginformationformat=debugenabled; varLinkTool = config. Tools (' VCLinkerTool '); //TODO: Add linker settingsLinktool.moduledefinitionfile = strprojectname+ ". def"; Linktool.generatedebuginformation=true; Linktool.subsystem=subsystemwindows; } Catch(e) {Throwe; }}functionPchsettings (proj) {//TODO: Specify PCH settings}functionDelfile (FSO, strwiztempfile) {Try { if(FSO. FileExists (Strwiztempfile)) {varTmpfile =FSO. GetFile (Strwiztempfile); Tmpfile.delete (); } } Catch(e) {Throwe; }}functionCreatecustominffile () {Try { varFSO, Templatesfolder, Templatefiles, strtemplate; FSO=NewActiveXObject (' Scripting.FileSystemObject '); varTemporaryfolder = 2; varTfolder =FSO. GetSpecialFolder (Temporaryfolder); varStrtempfolder = Tfolder. Drive + ' \ \ ' +Tfolder. Name; varStrwiztempfile = strtempfolder + "\ \" +FSO. GetTempName (); varStrtemplatepath = Wizard. FindSymbol (' Templates_path '); varStrinffile = Strtemplatepath + ' \\Templates.inf '; Wizard. Rendertemplate (Strinffile, strwiztempfile); varWiztempfile =FSO. GetFile (Strwiztempfile); returnWiztempfile; } Catch(e) {Throwe; }}functiongettargetname (StrName, strprojectname) {Try { //TODO: Set the name of the rendering file based on the template file name varStrtarget =StrName; if(StrName = = ' Readme.txt ') Strtarget= ' ReadMe.txt '; if(StrName = = ' MoonDriver.cpp ') Strtarget=strprojectname+ '. cpp '; if(StrName = = ' Moondriver.def ') Strtarget=strprojectname+ '. def '; if(StrName = = ' MoonDriver.h ') Strtarget=strprojectname+ '. h '; returnstrtarget; } Catch(e) {Throwe; }}functionaddfilestocustomproj (proj, Strprojectname, Strprojectpath, inffile) {Try { varProjitems =proj. ProjectItemsvarStrtemplatepath = Wizard. FindSymbol (' Templates_path '); varStrtpl = ' '; varStrName = ' '; varStrtextstream = Inffile.openastextstream (1,-2); while(!strtextstream.atendofstream) {STRTPL=Strtextstream.readline (); if(Strtpl! = ") {StrName=Strtpl; varStrtarget =gettargetname (StrName, strprojectname); varstrtemplate = Strtemplatepath + ' \ \ ' +Strtpl; varstrfile = Strprojectpath + ' \ \ ' +strtarget; varBcopyonly =false;//"true" only copies files from strtemplate to strtarget without rendering/adding the items varStrext = Strname.substr (Strname.lastindexof ("."))); if(strext== ". bmp" | | strext== ". ico" | | strext== ". gif" | | strext== ". rtf" | | strext== ". css" | | strext== ". Lib") Bcopyonly=true; Wizard. Rendertemplate (Strtemplate, strfile, bcopyonly); Proj. Object.addfile (strfile); }} strtextstream.close (); } Catch(e) {Throwe; }}