Add WTL Project Wizard to VS2015 (ATL/WTL Application Wizard)

Source: Internet
Author: User
Tags visual studio 2002

Just installed a VS2015 Community edition, Microsoft Earth Conscience Enterprise Ah ~~embarcader can learn a little?

vs Loaded High-end I will only use a WTL, so far (2015/08/09) WTL official online or only WTL9.0 version, the highest support to VS2013.

Open the WTL in the Appwiz\setup.js, after the test as long as the inside of a few arrays to add 2015 (14.0) related strings, and then perform a setup.js once.

With modified Setup.js

Windows Template LIBRARY-WTL version 9.0//Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.////This file was a part of the Windows Template library.//the use and distribution terms Ftware is covered by the//Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)//which can be found in The file CPL.  TXT at the root of this distribution.//by using this software in any fashion, you is agreeing to be bound by//the terms of this license. You must don't remove this notice, or//any other, the from this software.//WTL App Wizard Universal Setup program for Visual S Tudiomain (); function main () {//Decode command line Argumentsvar bdebug = False;var belevated = False;var Args = wscript.ar Guments;for (var i = 0; i < args.length; i++) {if (args (i) = = "/debug") Bdebug = True;else if (Args (i) = = "/elevated") BEleva Ted = True;} See if UAC is Enabledvar Shell = WScript.CreateObject ("shell.application"); if (!belevated && Shell.isrestricted ("System", "EnableLUA")) {//Check the script is being run Interactively.if (! Wscript.interactive) {wscript.echo ("error:elevation required."); return;} Now relaunch the script, using the ' RunAs ' verb to elevatevar strparams = "\" "+ Wscript.scriptfullname +" \ ""; if (bdeb UG) Strparams + = "/debug"; Strparams + = "/elevated"; Shell.shellexecute (wscript.fullname, strparams, NULL, "RunAs"); return;} Create shell Objectvar Wsshell = WScript.CreateObject ("Wscript.Shell");//Create file system Objectvar Filesys = Wscrip T.createobject ("Scripting.FileSystemObject");//Get the folder containing the script Filevar strvalue = Filesys.getparentfoldername (Wscript.scriptfullname); if (strvalue = = NULL | | strvalue = = "") strvalue = "."; var strsourcefolder = Filesys.buildpath (strvalue, "Files"), if (bdebug) WScript.Echo ("Source:" + strsourcefolder); Filesys.folderexists (Strsourcefolder)) {wscript.echo ("Error:cannot Find Wizard folder" should be: "+ Strsourcefolder +" ), return; MessageBox (Wsshell, "Setup'll Search for installed versions of Visual Studio,\nand ask to add the WTL App, Wizard for each of the them. "); var strregkey_32 = "hklm\\software\\"; var strregkey_64 = "hklm\\software\\wow6432node\\"; var nversions = 12;var Astrregkeyver = new Array (); astrregkeyver[0] = "Microsoft\\visualstudio\\7.0\\setup\\vc\\productdir"; astrRegKeyVer[ 1] = "Microsoft\\visualstudio\\7.1\\setup\\vc\\productdir"; astrregkeyver[2] = "Microsoft\\visualstudio\\8.0\\setup \\VC\\ProductDir "; astrregkeyver[3] =" Microsoft\\visualstudio\\9.0\\setup\\vc\\productdir "; astrregkeyver[4] =" Microsoft\\visualstudio\\10.0\\setup\\vc\\productdir "; astrregkeyver[5] =" microsoft\\visualstudio\\11.0\\setup\\ Vc\\productdir "; astrregkeyver[6] =" Microsoft\\visualstudio\\12.0\\setup\\vc\\productdir "; astrRegKeyVer[7] =" Microsoft\\visualstudio\\14.0\\setup\\vc\\productdir "; astrregkeyver[8] =" microsoft\\vcexpress\\8.0\\setup\\vc\\ Productdir "; astrregkeyver[9] =" Microsoft\\vcexpress\\9.0\\setup\\vc\\productdir "; astrregkeyver[10] =" MicrosoFt\\vcexpress\\10.0\\setup\\vc\\productdir "; astrregkeyver[11] =" microsoft\\vcexpress\\11.0\\setup\\vc\\ Productdir "; astrregkeyver[12] =" Microsoft\\vcexpress\\12.0\\setup\\vc\\productdir "; var astrFolder = new Array (); Astrfolder[0] = "vcprojects"; astrfolder[1] = "vcprojects"; astrfolder[2] = "vcprojects"; astrfolder[3] = "vcprojects"; ASTRFOLDER[4] = "vcprojects"; astrfolder[5] = "vcprojects"; astrfolder[6] = "vcprojects"; astrfolder[7] = "vcprojects"; ASTRFOLDER[8] = "express\\vcprojects"; astrfolder[9] = "express\\vcprojects"; astrfolder[10] = "Express\\vcprojects"; ASTRFOLDER[11] = "vcprojects_wdexpress"; astrfolder[12] = "vcprojects_wdexpress"; var astrversions = new Array ();  Astrversions[0] = "Visual Studio 2002 (7.0)"; Astrversions[1] = "Visual Studio 2003 (7.1)"; astrversions[2] = "Visual Studio 2005 (8.0) "; astrversions[3] =" Visual Studio (9.0) "; Astrversions[4] =" Visual Studio (10.0) "; astrversions[5] = "Visual Studio (11.0)"; astrversions[6] = "Visual Studio (12.0)"; astrverSIONS[7] = "Visual Studio (14.0)"; Astrversions[8] = "Visual Studio 2005 Express (8.0)"; astrversions[9] = "Visual Stud IO Express (9.0) "; astrversions[10] =" Visual Studio Express (10.0) "; astrversions[11] =" Visual Studio-Expre SS (11.0) "; astrversions[12] =" Visual Studio Express (12.0) "; var abexpress = new Array (); Abexpress[0] = False;abexpre SS[1] = false;abexpress[2] = false;abexpress[3] = false;abexpress[4] = false;abexpress[5] = false;abexpress[6] = False;abE XPRESS[7] = false;abexpress[8] = true;abexpress[9] = true;abexpress[10] = true;abexpress[11] = true;abExpress[12] = True;v Ar astrwizver = new Array (); Astrwizver[0] = "7.0"; astrwizver[1] = "7.1"; astrwizver[2] = "8.0"; astrwizver[3] = "9.0"; Astrwi ZVER[4] = "10.0"; astrwizver[5] = "11.0"; astrwizver[6] = "12.0"; astrwizver[7] = "14.0"; astrwizver[8] = "8.0"; astrwizver[9  ] = "9.0"; astrwizver[10] = "10.0"; astrwizver[11] = "11.0"; astrwizver[12] = "12.0"; var nspecial = 4;var nwizspecial = 0;var Bfound = False;for (var i= 0; i < nversions; i++) {if (bdebug) WScript.Echo ("Looking for:" + astrversions[i]); Try{var Strvckey = strregkey_32 + astrregkeyver[i]; strvalue = Wsshell.regread (Strvckey);} catch (e) {Try{var strvckey_x64 = strregkey_64 + Astrregkeyver[i];strvalue = Wsshell.regread (strvckey_x64);} catch (e) {continue;}} var strdestfolder = Filesys.buildpath (strvalue, astrfolder[i]), if (bdebug) WScript.Echo ("Destination:" + strdestfolder ); if (! Filesys.folderexists (Strdestfolder)) continue;if (i = nspecial)//special case for Vs2010{var strcheckfile = FileSys.Bui Ldpath (Strdestfolder, "Vc.vsdir"); Filesys.fileexists (Strcheckfile)) continue;} Bfound = True;var STRMSG = "Found:" + astrversions[i] + "\n\ninstall WTL App Wizard?";   var bRet = MessageBox (Wsshell, STRMSG, True); if (BRet) {var bwizspecial = (i = = nwizspecial); Special case for Vs2002setupwizard (Wsshell, Filesys, Strsourcefolder, Strdestfolder, Astrwizver[i], bWizSpecial, Abexpress[i], bdebug);}} if (bfound) MessageBox (Wsshell, "done!"); ElsemessageboX (Wsshell, "Setup could not find Visual Studio installed");} function MessageBox (Wsshell, StrText, Byesno) {var nType = Byesno?   (4 + 32): 0; 4 = yes/no buttons, + = Questionmark icon, 0 = OK Buttonvar nretbtn = wsshell.popup (strText, 0, "WTL App Wizard Setup"   , NType); return (nretbtn = = 6); 6 = Yes;} function SetupWizard (Wsshell, Filesys, Strsourcefolder, Strdestfolder, Strwizver, Bwizspecial, bexpress, bDebug) {// Copy Filestry{var strsrc = Filesys.buildpath (Strsourcefolder, "Wtlappwiz.ico"); var strdest = Filesys.buildpath ( Strdestfolder, "Wtlappwiz.ico"); Filesys.copyfile (STRSRC, strdest); strsrc = Filesys.buildpath (Strsourcefolder, "Wtlappwiz.vsdir"); strDest = Filesys.buildpath (Strdestfolder, "Wtlappwiz.vsdir"); Filesys.copyfile (STRSRC, strdest);} catch (e) {var strerror = "No info"; if (e.description.length! = 0) strerror = e.description; WScript.Echo ("Error:cannot Copy file (" + strerror + ")"); return;} Read and write wtlappwiz.vsz, add engine version and replace path when FOUNDTRY{var strsrc = Filesys.buildpath (Strsourcefolder, "wtlappwiz.vsz"); var strdest = Filesys.buildpath (StrDestFolder, " Wtlappwiz.vsz "); var ForReading = 1;var filesrc = Filesys.opentextfile (strsrc, ForReading); if (filesrc = = null) { WScript.Echo ("Error:cannot Open source file" + strsrc); return;} var ForWriting = 2;var filedest = Filesys.opentextfile (strdest, ForWriting, True); if (filedest = = null) {WScript.Echo (" Error:cannot Open destination file "+ strdest); return;} while (!filesrc.atendofstream) {var strLine = Filesrc.readline (); if (!bwizspecial && (Strline.indexof ("wizard= Vswizard.vswizardengine ")! =-1)) StrLine + =". "+ Strwizver;else if (Strline.indexof (" wizard_version ")! =-1) strLine =" Pa Ram=\ "wizard_version =" + Strwizver + "\" "or else if (Strline.indexof (" Absolute_path ")! =-1) strLine =" Param=\ "Absolute_pa TH = "+ Strsourcefolder +" \ ""; Filedest.writeline (StrLine);} if (bexpress) filedest.writeline ("param=\" vc_express = 1\ ""); Filesrc.close (); Filedest.close ();} catch (e) {var strerror = "No Info "; if (e.description.length! = 0) strerror = e.description; WScript.Echo ("Error:cannot Read and Write Wtlappwiz.vsz (" + strerror + ")"); return;} Create WTL Foldervar strdestwtlfolder = ""; try{strdestwtlfolder = Filesys.buildpath (Strdestfolder, "WTL"); Filesys.folderexists (Strdestwtlfolder)) Filesys.createfolder (Strdestwtlfolder), if (bdebug) WScript.Echo ("WTL Folder: "+ Strdestwtlfolder);} catch (e) {var strerror = "No info"; if (e.description.length! = 0) strerror = e.description; WScript.Echo ("Error:cannot Create WTL folder (" + strerror + ")"); return;} Read and write additional wtlappwiz.vsdir, add path to the wizard Locationtry{var strsrc = Filesys.buildpath (strsourcef Older, "Wtlappwiz.vsdir"), var strdest = Filesys.buildpath (Strdestwtlfolder, "Wtlappwiz.vsdir"); var ForReading = 1;var FILESRC = Filesys.opentextfile (STRSRC, ForReading), if (filesrc = = null) {WScript.Echo ("Error:cannot Open source file" + St RSRC); return;} var ForWriting = 2;var filedest = Filesys.opentextfile (strdest, ForWriting, True), if (filedest = = null) {WScript.Echo ("Error:cannot Open destination file" + strdest); return;} while (!filesrc.atendofstream) {var strLine = Filesrc.readline (); if (Strline.indexof ("wtlappwiz.vsz|")! =-1) strLine = " .. \ \ "+ strline;filedest.writeline (strLine);} Filesrc.close (); Filedest.close ();} catch (e) {var strerror = "No info"; if (e.description.length! = 0) strerror = e.description; WScript.Echo ("Error:cannot Read and Write Wtl\\wtlappwiz.vsdir (" + strerror + ")"); return;} WScript.Echo ("App Wizard successfully installed!");}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Add WTL Project Wizard to VS2015 (ATL/WTL Application Wizard)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.