IIS 自动配置

来源:互联网 发布:精准数据挖掘系统 编辑:程序博客网 时间:2024/05/01 18:18
//===========================================================================////  File Name:    Setup.rul////  Description:  Blank setup main script file////  Comments:     Blank setup is an empty setup project. If you want to//      create a new project via. step-by step instructions use the//      Project Assistant.////===========================================================================// Included header files ----------------------------------------------------#include "ifx.h"#define Emty  "" //宏定义DOS功能把Emty 替换为""#define SOFTNAME   "webbk" prototype RegUnInstall(STRING);string szDir, szVirtual;prototype void CheckRequirements(); //检测系统必备.net和iis prototype void CreateVirtualDir(STRING,string);//创建虚拟目录 参数1虚拟目录名 参数2物理路径function OnFirstUIBefore()       number  nResult,nSetupType;    string  szName, szCompany;    string  szTargetPath;    string  szTargetdir;    number  nLevel;    LIST    listStartCopy;    number  nvSize;   begin  nSetupType = TYPICAL; //默认安装类型    CheckRequirements();      Dlg_SdWelcome:    SetTitle (@TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION);            nResult = SdWelcome( "欢迎使用材料辅助设计软件安装向导","以下将在你的计算机上安装材料辅助设计软件,若要继续安装,请点击下一步......" ); Dlg_SdLicense:     nResult= SdLicense( Emty, Emty, Emty,  SUPPORTDIR ^ "license.rtf" );    if (nResult = BACK) goto Dlg_SdWelcome;Dlg_SdRegisterUserEx:      nResult = SdRegisterUser( Emty, Emty, szName, szCompany );    if (nResult = BACK) goto Dlg_SdLicense;Dlg_SdAskDestPath:    TARGETDIR = PROGRAMFILES^SOFTNAME;    szDir = TARGETDIR;     nResult = AskDestPath( Emty, Emty, szDir,0 );    TARGETDIR = szDir;    if (nResult = BACK) goto Dlg_SdRegisterUserEx;   Dlg_AskVitualDir :   szVirtual=@PRODUCT_NAME;     SetDialogTitle(DLG_ASK_TEXT,Emty); nResult=SdShowDlgEdit1 ("设置虚拟目录", "请输入虚拟目录名,安装程序将设置IIS信息服务./n如果您没有填写,安装程序将按默认方式创建!","虚拟目录名称:",szVirtual);    if (nResult = BACK) goto Dlg_SdAskDestPath;   Dlg_SdStartCopy:    if (szVirtual = "") then    MessageBox ("请输入虚拟目录的名称!",INFORMATION) ;     goto  Dlg_AskVitualDir;   endif;        listStartCopy = ListCreate( STRINGLIST );    ListAddString(listStartCopy,"用户名:"+szName,AFTER);    ListAddString(listStartCopy,"公司名称:"+szCompany,AFTER);      ListAddString(listStartCopy,"目标目录:"+szDir,AFTER);    ListAddString(listStartCopy,"虚拟目录:"+szVirtual,AFTER);      ListAddString(listStartCopy,"请确认您填写的信息,按下一步开始复制文件",AFTER);    nResult = SdStartCopy( "", "", listStartCopy );    ListDestroy(listStartCopy);    if (nResult = BACK) goto Dlg_SdAskDestPath;              SetStatusWindow(0, "");       Enable(STATUSEX);       StatusUpdate(ON, 100);         return 0;end;function OnMoving()    string szAppPath;begin//    RegUnInstall("");//    szAppPath = TARGETDIR;//    RegDBSetItem(REGDB_APPPATH, szAppPath);//    RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);end;  function void CheckRequirements()  begin SdShowMsg ("安装程序正在检测系统必备组件......",TRUE); Delay(1);  SdShowMsg (Emty,FALSE); RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE ); if (RegDBKeyExist ("System//CurrentControlSet//Services//matlabserver" ) != 1) then    if(SprintfBox(MB_OK,"检测系统环境","你的计算机没有被安装matlabserver,请安装后重试,安装程序将退出!")=IDOK)   then exit;  endif;  endif; if (RegDBKeyExist ("System//CurrentControlSet//Services//IISADMIN" ) != 1) then    if(SprintfBox(MB_OK,"检测系统环境","你的计算机没有被安装IIS,请安装后重试,安装程序将退出!")=IDOK)   then exit;    endif; endif;   if (RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework//policy//v2.0" ) != 1) then          if(LaunchAppAndWait ( SUPPORTDIR ^"dotnetfx.exe" , "/q:a/l" ,WAIT)<0) then      SprintfBox(MB_OK,".NET安装","安装.net框架时发生意外,请重新安装!");    endif; endif;  //注册aspnet服务 //开取matlab web server 服务     end; function  void CreateVirtualDir(VirtualFolder, szDir)begin if (VirtualFolder = "") then MessageBox ("请输入虚拟目录的名称!",INFORMATION) ; else SdShowMsg (" 正在创建虚拟目录"+VirtualFolder+"请不要关闭....", TRUE); Delay(1); LaunchAppAndWait(SUPPORTDIR^"Create.exe", VirtualFolder+" /""+TARGETDIR+"/" ",WAIT); //AddFolderIcon (FOLDER_DESKTOP , "爱普管理系统" ,"http://localhost"^VirtualFolder^"Default.aspx" ,Emty, Emty, 0, Emty, REPLACE|RUN_MINIMIZED);   //这里不知道为什么 只要创建快捷方式就很卡 得等待很久 //AddFolderIcon ( FOLDER_PROGRAMS , "爱普管理系统" ,"http://localhost"^VirtualFolder^"Default.aspx" ,Emty, Emty, 0, Emty, REPLACE|RUN_MINIMIZED); SdShowMsg (Emty,FALSE); endif;end; function OnFirstUIAfter()           NUMBER bOpt1, bOpt2,nResult, nDefOptions;         begin      Disable(STATUSEX);     CreateVirtualDir(szVirtual, szDir);//这里会出现Dos窗口     if (!BATCH_INSTALL) then      bOpt1 = FALSE;      bOpt2 = TRUE;         nResult = SdFinish( "安装完成","已经成功安装系统,单击完成以退出安装向导", Emty, "阅读Readme文件", "立刻运行程序", bOpt1, bOpt2 );          if bOpt1 = TRUE then       CopyFile (SUPPORTDIR^"Readme.txt" , "Readme.txt" );       LaunchApp ( WINDIR^"Notepad.exe" , TARGETDIR^"Readme.txt" );      endif;      if  bOpt2=TRUE then        LaunchAppAndWait(SUPPORTDIR^"IEXPLORE.EXE","localhost"^szVirtual^"login.aspx",NOWAIT) ;       endif;       return 0;     endif;         end;function OnMaintUIAfter()    STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;    NUMBER bOpt1, bOpt2;begin Disable(STATUSEX);    ShowObjWizardPages(NEXT); bOpt1   = FALSE; bOpt2   = FALSE; szMsg1  = SdLoadString(IFX_SDFINISH_MAINT_MSG1); szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE); SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);end; 


原创粉丝点击