设为首页 收藏本站
查看: 747|回复: 0

[经验分享] WTL Wizard for Visual Studio 2008

[复制链接]

尚未签到

发表于 2016-5-22 10:21:30 | 显示全部楼层 |阅读模式
  WTL 正式版到现在还是8.0,虽然8.1已经提供下载,但我还是等正式版吧。
  在WTL 8.0中没有提供AppWiz For 2008, 我看了下,应该就是改下注册表就行了。
  google了下,CodeGem老兄已经提供了,我就试了下,没啥问题,就提供给大家。
  原文:http://codegem.org/2008/09/wtl-wizard-for-visual-studio-2008
   // Windows Template Library - WTL version 8.0  // Copyright (C) Microsoft Corporation. All rights reserved.  //  // This file is a part of the Windows Template Library.  // The use and distribution terms for this software are covered by the  // Common Public License 1.0 (http://opensource.org/osi3.0/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 are agreeing to be bound by  // the terms of this license. You must not remove this notice, or  // any other, from this software.  // Setup program for the WTL App Wizard for VC++ 9.0 (2008)  main();  function main()  {  // Decode command line arguments  var bDebug = false;  var bElevated = false;  var Args = WScript.Arguments;  for(var i = 0; i < Args.length; i++)  {  if(Args(i) == "/debug")  bDebug = true;  else if(Args(i) == "/elevated")  bElevated = true;  }  // See if UAC is enabled  var Shell = WScript.CreateObject("Shell.Application");  if(!bElevated && Shell.IsRestricted("System", "EnableLUA"))  {  // Check that the script is being run interactively.  if(!WScript.Interactive)  {  WScript.Echo("ERROR: Elevation required.");  return;  }  // Now relaunch the script, using the "RunAs" verb to elevate  var strParams = "\"" + WScript.ScriptFullName + "\"";  if (bDebug)  strParams += " /debug";  strParams += " /elevated";  Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs");  return;  }  // Create shell object  var WSShell = WScript.CreateObject("WScript.Shell");  // Create file system object  var FileSys = WScript.CreateObject("Scripting.FileSystemObject");  // Get the folder containing the script file  var strValue = FileSys.GetParentFolderName(WScript.ScriptFullName);  if(strValue == null || strValue == "")  strValue = ".";  var strSourceFolder = FileSys.BuildPath(strValue, "Files");  if(bDebug)  WScript.Echo("Source: " + strSourceFolder);  if(!FileSys.FolderExists(strSourceFolder))  {  WScript.Echo("ERROR: Cannot find Wizard folder (should be: " + strSourceFolder + ")");  return;  }  try  {  var strVC9Key = "HKLM\\Software\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir";  strValue = WSShell.RegRead(strVC9Key);  }  catch(e)  {  try  {  var strVC9Key_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir";  strValue = WSShell.RegRead(strVC9Key_x64);  }  catch(e)  {  WScript.Echo("ERROR: Cannot find where Visual Studio 9.0 is installed.");  return;  }  }  var strDestFolder = FileSys.BuildPath(strValue, "vcprojects");  if(bDebug)  WScript.Echo("Destination: " + strDestFolder);  if(!FileSys.FolderExists(strDestFolder))  {  WScript.Echo("ERROR: Cannot find destination folder (should be: " + strDestFolder + ")");  return;  }  // Copy files  try  {  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 found  try  {  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(strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1)  strLine += ".9.0";  else if(strLine.indexOf("WIZARD_VERSION") != -1)  strLine = "Param=\"WIZARD_VERSION = 9.0\"";  else if(strLine.indexOf("ABSOLUTE_PATH") != -1)  strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";  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 WTLAppWiz.vsz (" + strError + ")");  return;  }  // Create WTL folder  var strDestWTLFolder = "";  try  {  strDestWTLFolder = FileSys.BuildPath(strDestFolder, "WTL");  if(!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 location  try  {  var strSrc = FileSys.BuildPath(strSourceFolder, "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 " + 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(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!");  }
  大家保存到WTL80目录下的AppWiz下即可。
  如图:
DSC0000.gif

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-220231-1-1.html 上篇帖子: Remote debugging with Visual Studio 2008 下篇帖子: Visual Studio 2008的一些小技巧
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表