installshield 安裝腳本實例

實現的功能::java

1.檢測是否安裝JDK,TOMCAT,MYSQL,APACHE HTTP,若是沒安裝,提示安裝,不然中斷mysql

2.檢測jdk版本
web

3.註冊系統服務Tomcat/刪除系統服務redis

4.設置環境變量sql

5.添加啓動項數據庫

6.添加快捷方式
apache


#include "ifx.h"windows

export prototype  installJDK() ; export prototype  getJAVA_HOME();     export prototype  installMysql();   export prototype  installTomcat(); export prototype installHttp(); export prototype addFileValue(string,string,string,string); string password,Java_Home; /*-------------------------------------------------------------------*/ /* 安裝JDK */ function installJDK() string  szJDK,  szKey ,JDKversion ; number  nType, nvSize; begin     // 查看是否已經安裝了JDK,並且版本大於5.0     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SOFTWARE\\JavaSoft\\Java Development Kit";       nType = REGDB_STRING;       JDKversion = "";       // Get the list of subkeys.       RegDBGetKeyValueEx(szKey, "CurrentVersion", nType, JDKversion, nvSize);     if(JDKversion < "1.5") then              if(AskYesNo ( "系統檢測到您機器上未安裝JDK或者JDK版本太低,會影響系統的正常使用。\n\n接下來將爲您安裝 JDK 6.0     \n\nJDK的版權歸Sun公司全部 ...", YES )=YES) then               szJDK =  SUPPORTDIR ^ "jdk-6-windows.exe";                    if (LaunchAppAndWait (szJDK, "", WAIT) < 0) then                        MessageBox ("加載JDK失敗,請手動安裝JDK5.0或以上版本再運行此程序",SEVERE);                        abort;                      endif;            else                 MessageBox("您取消了JDK的安裝,這會使系統沒法正常運行,\n\n因此本安裝程序不會繼續安裝,將退出安裝!",INFORMATION);                 abort;              endif;                     endif;        JDKversion="";             RegDBGetKeyValueEx(szKey, "CurrentVersion", nType, JDKversion, nvSize);             if(JDKversion < "1.5") then             MessageBox("系統檢測到您未正常安裝JDK,本程序將退出。\n\n您能夠:\n\n一、手動安裝JDK5.0或以上版本.\n\n二、從新運行本程序,按照提示安裝JDK.",SEVERE);                             abort;      endif; end; /*-----------------------------------------------------------------------------*/ function  installMysql() string  szJDK,  szKey ,szDisplayName ; number  nType, nvSize; begin     // 查看是否已經安裝了Mysql     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SYSTEM\\CurrentControlSet\\Services\\MySQL";       nType = REGDB_STRING;       szDisplayName = "";       // Get the list of subkeys.       if(RegDBGetKeyValueEx(szKey, "DisplayName", nType, szDisplayName, nvSize)<0) then         if(AskYesNo ( "系統檢測到您機器上未安裝Mysql,會影響系統的正常使用。\n\n接下來將爲您安裝 Mysql 5.0", YES )=YES) then               szJDK =  SUPPORTDIR ^ "mysql Setup.exe";                    if (LaunchAppAndWait (szJDK, "", WAIT) < 0) then                        MessageBox ("加載Mysql失敗,請手動安裝Mysql再運行此程序",SEVERE);                        abort;                      endif;            else                 MessageBox("您取消了Mysql的安裝,這會使系統沒法正常運行,\n\n因此本安裝程序不會繼續安裝,將退出安裝!",INFORMATION);                 abort;              endif;                     endif; end;     /*---------------------------------------------------------------------------*/ /*   安裝Tomcat */ function  installTomcat() string  szJDK,  szKey ,szDisplayName ; number  nType, nvSize; begin     // 查看是否已經安裝了Tomcat     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SYSTEM\\CurrentControlSet\\Services\\Tomcat7";       nType = REGDB_STRING;       szDisplayName = "";       // Get the list of subkeys.       if(RegDBGetKeyValueEx(szKey, "DisplayName", nType, szDisplayName, nvSize)<0) then         if(AskYesNo ( "系統檢測到您機器上未安裝Tomcat7,會影響系統的正常使用。\n\n接下來將爲您安裝 Tomcat7", YES )=YES) then               szJDK =  SUPPORTDIR ^ "apache-tomcat-7.0.27.exe";                    if (LaunchAppAndWait (szJDK, "", WAIT) < 0) then                        MessageBox ("加載Tomcat7失敗,請手動安裝Tomcat7再運行此程序",SEVERE);                        abort;                      endif;            else                 MessageBox("您取消了Tomcat7的安裝,這會使系統沒法正常運行,\n\n因此本安裝程序不會繼續安裝,將退出安裝!",INFORMATION);                 abort;              endif;                     endif; end;     /*---------------------------------------------------------------------------*/ /** 安裝Apache Http */               function installHttp()     string  szJDK,  szKey ,szDisplayName ;     number  nType, nvSize;       begin     // 查看是否已經安裝了Apache     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);         szKey = "SYSTEM\\CurrentControlSet\\Services\\Apache";       nType = REGDB_STRING;       szDisplayName = "";       // Get the list of subkeys.       if(RegDBGetKeyValueEx(szKey, "DisplayName", nType, szDisplayName, nvSize)<0) then         if(AskYesNo ( "系統檢測到您機器上未安裝Apache,會影響系統的正常使用。\n\n接下來將爲您安裝 Apache,\n\n若是選擇取消,將中斷本次安裝", YES )=YES) then               szJDK =  SUPPORTDIR ^ "Apache HTTP Server.exe";                    if (LaunchAppAndWait (szJDK, "", WAIT) < 0) then                        MessageBox ("加載Apache Http Server失敗,請手動安裝Apache Http Service再運行此程序",SEVERE);                        abort;                      endif;            else                 MessageBox("您取消了Apache Http Server的安裝,這會使系統沒法正常運行,\n\n因此本安裝程序不會繼續安裝,將退出安裝!",INFORMATION);                 abort;              endif;                     endif; end;    /*---------------------------------------------------------------------------*/   /** 設置環境變量 */ function getJAVA_HOME() /*JAVA_HOME註冊表參數*/ string szKey,JDKDir,nzVersion; number nType,nvSize,szRoot; begin  /*JAVA_HOME加入環境變量*/    szRoot= HKEY_LOCAL_MACHINE;  RegDBSetDefaultRoot(szRoot);  szKey = "SOFTWARE\\JavaSoft\\Java Development Kit";  nType = REGDB_STRING;  RegDBGetKeyValueEx(szKey, "CurrentVersion", nType, nzVersion, nvSize);  szKey=szKey+"\\"+nzVersion;  RegDBGetKeyValueEx(szKey, "JavaHome", nType, JDKDir, nvSize);      Java_Home= JDKDir; end; /*--------------------------------------------------------------------------*/ function OnFirstUIBefore()     number  nResult, nLevel, nSize, nSetupType;     string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;     string  szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;     BOOL    bLicenseAccepted;     string  szField0,szField1,szField2,svEdit0,svEdit1,svEdit2,svEdit3,svEdit4;       string  szJDK,svTomcat,svMySql,szKey ,szDisplayName,szFolder,szCmdLine,szSrcFile1;     number  nType,nvSize;     string test1,test2;          LIST list, listStartCopy; begin             nSetupType = COMPLETE;         szName = "";     szCompany = "";     bLicenseAccepted = FALSE;       TARGETDIR = PROGRAMFILES ^@COMPANY_NAME ^@PRODUCT_NAME;     szDir = TARGETDIR;                                                szSrcFile1 = "hospital\\"; // Beginning of UI Sequence Dlg_Start:  nResult = 0;    /*安裝JDK*/  installJDK();      /* 獲取JAVA_HOME*/  getJAVA_HOME();    /*安裝Tomcat7*/  /*installTomcat();*/  /*安裝apache http*/  installHttp();    /*安裝Mysql數據庫*/  installMysql();                  Dlg_SdWelcome:     szTitle = "";     szMsg = "";     //{{IS_SCRIPT_TAG(Dlg_SdWelcome)     nResult = SdWelcome( szTitle, szMsg );     //}}IS_SCRIPT_TAG(Dlg_SdWelcome)           if (nResult = BACK) goto Dlg_Start; Dlg_SdRegisterUser:     szMsg = "";     szTitle = "";     //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)         nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );     //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)     if (nResult = BACK) goto Dlg_SdWelcome;  Dlg_SdShowDlgEdit2:    // 查看是否已經安裝了Mysql     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SYSTEM\\CurrentControlSet\\Services\\MySQL";       nType = REGDB_STRING;       szDisplayName = "";       // Get the list of subkeys.       if(RegDBGetKeyValueEx(szKey, "DisplayName", nType, szDisplayName, nvSize)<0) then         if(AskYesNo("系統檢測到您未正常安裝Mysql數據庫,會影響短信系統的正常使用。\n\n你能夠:\n\n一、安裝完本系統後手動安裝Mysql數據庫,並手動建立相應數據庫!\n\n二、退出本系統的安裝,從新安裝本系統!\n\n繼續安裝請選擇 是(Y),退出安裝選擇 否(N)!",YES)=YES) then         else             abort;         endif;         else             szTitle = "數據庫信息";                szMsg    = "請更改相應的Mysql數據庫用戶名和數據庫密碼:";             //szField0 ="bin目錄路徑";                  szField1 = "用戶名";                szField2 = "密碼";               // svEdit0 = "C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin";             svEdit1 = "root";                svEdit2 = "123456";                        nResult = SdShowDlgEdit2(szTitle, szMsg,szField1,szField2, svEdit1,svEdit2);             if (nResult = BACK) goto Dlg_SdRegisterUser;             //SdShowMsg ("下面進行數據庫初始化操做,請勿手動關閉彈出窗口!", TRUE);             //Delay(2);                           CopyFile(SUPPORTDIR ^ "CreateDB.sql","c:\\"^"CreateDB.sql");          CopyFile(SUPPORTDIR ^ "hospital.sql","c:\\"^"hospital.sql");          RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);            szKey = "SOFTWARE\\MySQL AB\\MySQL Server 5.0";         nType = REGDB_STRING;           svMySql = "";         if(RegDBGetKeyValueEx(szKey, "Location", nType, svMySql, nvSize) < 0) then             MessageBox ("查找MySQL路徑失敗,系統不能繼續安裝", SEVERE);                 abort;         endif;         szDir = svMySql + "bin";            test1="\"";         test2="\"";         svEdit0 = test1+szDir+test2;                //啓動mysql                                               LaunchAppAndWait("net","start mysql",WAIT);                                                                                                   szJDK =  SUPPORTDIR ^ "hospital.bat";          svEdit3 =  "C:\\"^"CreateDB.sql";          svEdit4 =  "C:\\"^"hospital.sql";          LaunchAppAndWait(szJDK," " + svEdit0 + " " + svEdit1 + " " + svEdit2 + " " + svEdit3 + " " + svEdit4 + " ",WAIT);          // 準備啓動MySQL服務器              LaunchAppAndWait ("net","start mysql"   ,WAIT );  //啓動MySQL          password=svEdit2;          DeleteFile("c:\\CreateDB.sql");          DeleteFile("c:\\hospital.sql");    endif;      /*         //查看Tomcat安裝路徑     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SOFTWARE\\Apache Software Foundation\\Tomcat\\7.0\\Tomcat7";     nType = REGDB_STRING;       svTomcat = "";     if(RegDBGetKeyValueEx(szKey, "InstallPath", nType, svTomcat, nvSize) < 0) then         MessageBox ("查找 Tomcat 路徑失敗,系統不能繼續安裝", SEVERE);            abort;       endif;                szDir = svTomcat + "\\webapps";     MessageBox("正在準備Tomcat附加程序文件。。。",INFORMATION);     CreateDir(szDir);                                                                     if( CopyFile(SUPPORTDIR ^ "struts2.war",szDir+"\\struts2.war")<0)          then            MessageBox("程序文件附加失敗!",SEVERE);         abort;                   else            MessageBox("程序文件已經附加成功!",INFORMATION);     endif;     */ Dlg_SetupType2:        szTitle = "";     szMsg = "";     nResult = CUSTOM;     //{{IS_SCRIPT_TAG(Dlg_SetupType2)         nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );     //}}IS_SCRIPT_TAG(Dlg_SetupType2)     if (nResult = BACK) then         goto Dlg_SdRegisterUser;     else         nSetupType = nResult;         if (nSetupType != CUSTOM) then             szTargetPath = TARGETDIR;             nSize = 0;             FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );             if (nSize != 0) then                       MessageBox( szSdStr_NotEnoughSpace, WARNING );                 goto Dlg_SdRegisterUser;             endif;         endif;        endif; Dlg_SdAskDestPath2:     if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;     szTitle = "";     szMsg = "";     if (nSetupType = CUSTOM) then                 //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)                    nResult = SdAskDestPath2( szTitle, szMsg, TARGETDIR);                 //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)         //TARGETDIR = szDir;     endif;     if (nResult = BACK) goto Dlg_SetupType2;      /*Dlg_SQLServer:     nResult = OnSQLServerInitialize( nResult );     if( nResult = BACK ) goto Dlg_SdAskDestPath2; */ Dlg_ObjDialogs:     nResult = ShowObjWizardPages( nResult );     if (nResult = BACK) goto Dlg_SdAskDestPath2; Dlg_SdStartCopy2:               szTitle = "";     szMsg   = "";     listStartCopy = ListCreate( STRINGLIST );     //The following is an example of how to add a string(svName) to a list(listStartCopy).     //eg. ListAddString(listStartCopy,svName,AFTER);        ListAddString(listStartCopy,"Destination Location: " + INSTALLDIR,AFTER);     nResult = SdStartCopy( szTitle, szMsg, listStartCopy );                 ListDestroy(listStartCopy);          if (nResult = BACK) then         goto Dlg_ObjDialogs;     endif;     // setup default status     Enable(STATUSEX);       return 0; end;   //--------------------------------------------------------------------------- // OnFirstUIAfter // // The OnFirstUIAfter event called by the framework after the file transfer // of the setup when the setup is running in first install mode. By default // this event displays UI that informs the end user that the setup has been // completed successfully. //--------------------------------------------------------------------------- function OnFirstUIAfter()     STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;     NUMBER bOpt1, bOpt2,bStartService;       string szKey,svTomcat,szCmdLine,szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile,szStartServiceArgs;     string szJDK,svEdit3,svEdit4,svEdit0,svEdit1,svEdit2;     number nType,nvSize;        string JDKversion,svValue; begin     Disable(STATUSEX);     bOpt1  = FALSE;     bOpt2  = FALSE;     szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);     SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);                  /*-------------------------設置環境變量-------------------------------*/     // 查看是否已經安裝了JDK,並且版本大於5.0     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SOFTWARE\\JavaSoft\\Java Development Kit";       nType = REGDB_STRING;       JDKversion = "";       // Get the list of subkeys.       RegDBGetKeyValueEx(szKey, "CurrentVersion", nType, JDKversion, nvSize);     szKey = "SOFTWARE\\JavaSoft\\Java Development Kit"+JDKversion;     if (RegDBKeyExist(szKey)=1) then//若是該註冊表值存在         if(RegDBGetKeyValueEx(szKey,"JavaHome",nType,svValue,nvSize)=0) then//獲取註冊表值成功             szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";             if(RegDBSetKeyValueEx(szKey, "JAVA_HOME", REGDB_STRING, svValue, -1)<0) then                 MessageBox ("JAVA_HOME環境變量設置失敗,請手動設置", SEVERE);             endif;         endif;     endif;     /*---------------------tomcat環境變量設置--------------------*/     /*     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SYSTEM\\CurrentControlSet\\Services\\tomcat7";       nType = REGDB_STRING;       szDisplayName = "";       // Get the list of subkeys.       if (RegDBKeyExist(szKey)=1) then//若是該註冊表值存在         if(RegDBGetKeyValueEx(szKey,"JavaHome",nvType,svValue,nvSize)=0) then//獲取註冊表值成功             szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";             if(RegDBSetKeyValueEx(szKey, "CATALINA_HOME", REGDB_STRING, svValue, -1)<0) then                 MessageBox ("JAVA_HOME環境變量設置失敗,請手動設置", SEVERE);             endif;         endif;     endif;     */     //註冊Tomcat7服務          /*     //註冊的服務名稱     szServiceName="tomcat7";     //服務顯示名稱     szServiceDisplayName="tomcat7";     //服務描述     szServiceDescription="tomcat服務";     //程序文件的路徑,安裝路徑下的Server目錄下的test.exe文件     szServicePathFile=TARGETDIR^"\\apache-tomcat7-web\\bin\\tomcat7.exe";     MessageBox("exe路徑:"+szServicePathFile,INFORMATION);                   //啓動類型爲自動     bStartService=0;     szStartServiceArgs="";     ServiceAddService ( szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile, bStartService, szStartServiceArgs );     ServiceStartService(szServiceName,"");              */     /*     // 準備啓動TOMCAT服務器     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        szKey = "SOFTWARE\\Apache Software Foundation\\Tomcat\\7.0\\Tomcat7";     nType = REGDB_STRING;       svTomcat = "";        if(RegDBGetKeyValueEx(szKey, "InstallPath", nType, svTomcat, nvSize) < 0) then         MessageBox ("查找 Tomcat 路徑失敗,系統不能繼續安裝", SEVERE);          endif;       svTomcat = svTomcat + "\\bin\\tomcat7.exe";     LaunchAppAndWait (svTomcat,"",NOWAIT);  //啓動tomcat       */       szJDK =  SUPPORTDIR ^ "install.bat";     svEdit0="\"";     svEdit2="\"";        svEdit3 =  TARGETDIR^"\\apache-tomcat7-cas";     svEdit4 =  TARGETDIR^"\\apache-tomcat7-service";     svEdit1 =  TARGETDIR^"\\apache-tomcat7-web";//tomcat執行路徑              svEdit3 =  svEdit0+svEdit3+svEdit2;     svEdit4 =  svEdit0+svEdit4+svEdit2;     svEdit1 =  svEdit0+svEdit1+svEdit2;     Java_Home= svEdit0+Java_Home+svEdit2;       //MessageBox("java_home路徑:"+Java_Home,INFORMATION);       //MessageBox("Tomcat路徑:"+svEdit1,INFORMATION);     LaunchAppAndWait(szJDK," " + Java_Home + " " + svEdit3 + " ",WAIT);     szJDK =  SUPPORTDIR ^ "tomcat_service.bat";     LaunchAppAndWait(szJDK," " + Java_Home + " " + svEdit4 + " ",WAIT);     szJDK =  SUPPORTDIR ^ "tomcat_web.bat";     LaunchAppAndWait(szJDK," " + Java_Home + " " + svEdit1 + " ",WAIT);     // 準備啓動MySQL服務器         //LaunchAppAndWait ("net","start tomcat7"   ,WAIT );  //啓動MySQL     MessageBox("Tomcat 已經啓動成功!正在準備打開網頁....",INFORMATION);     //準備打開瀏覽器     szCmdLine = "http://LocalHost:8380/struts2";     if (LaunchApp(PROGRAMFILES ^"Internet Explorer"^"IEXPLORE.EXE", szCmdLine) < 0) then         MessageBox ("不能打開瀏覽器.",SEVERE);     endif;           // Added in 11.0 - Set appropriate StatusEx static text.     SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );     return 0; end;      //--------------------------------------------------------------------------- // OnMaintUIAfter // // The OnMaintUIAfter event called by the framework after the file transfer // of the setup when the setup is running in maintenance mode. By default // this event displays UI that informs the end user that the maintenance setup // has been completed successfully. //--------------------------------------------------------------------------- function OnMaintUIAfter()     STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;     NUMBER bOpt1, bOpt2;       string szJDK,svEdit0,svEdit1,svEdit2,svEdit3,svEdit4; begin     Disable(STATUSEX);     bOpt1   = FALSE;     bOpt2   = FALSE;     Dlg_Start:     // Added - Version 9.5 - Use appropriate strings for complete     // uninstall.     if( REMOVEALLMODE ) then         szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);         szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);       else         szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);             szMsg1  = SdLoadString(IFX_SDFINISH_MAINT_MSG1);     endif;     SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); end; //--------------------------------------------------------------------------- // OnMaintUIBefore // // The OnMaintUIBefore event is called by the framework when the setup is // running in maintenance mode. By default this event displays UI that // allows the end user to add or remove features, repair currently // installed features or uninstall the application. //--------------------------------------------------------------------------- function OnMaintUIBefore()     NUMBER nResult, nType;     STRING szTitle, szMsg, svDir, svResult, szCaption; begin     // TO DO: if you want to enable background, window title, and caption bar title                                        // SetTitle( @PRODUCT_NAME, 24, WHITE );                         // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );                   // SetColor(BACKGROUND,RGB (0, 128, 128));                         // Enable( FULLWINDOWMODE );                             // Enable( BACKGROUND );                                  Dlg_Start:     // Added in Version 9.5 - Support for REMOVEONLY option.     if( !REMOVEONLY ) then         // In standard mode show maintenance dialog         Disable(BACKBUTTON);         nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);         Enable(BACKBUTTON);     else         // Hide the initial progress dialog as otherwise the user can         // click on it, and hide the MessageBox.         Disable( DIALOGCACHE );         // In RemoveOnly mode, set to remove.         nType = REMOVEALL;     endif;          // Show Uninstall Confirmation Dialog     if ( nType = REMOVEALL ) then         nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );         if (nResult != IDYES ) then                          if( REMOVEONLY ) then                 // In REMOVEONLY mode, abort the setup.                 abort;             else                 // In non-REMOVEONLY mode, redisplay the previous dialog.                 goto Dlg_Start;             endif;         endif;     endif;     nResult = NEXT; Dlg_SdFeatureTree:     if (nType = MODIFY) then         szTitle = "";         szMsg = "";         nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);         if (nResult = BACK) goto Dlg_Start;     endif;     switch(nType)         case REMOVEALL: FeatureRemoveAll();                          /*-----------卸載tomcat7服務-------------------*/         LaunchAppAndWait ( "", "sc stop tomcat7", LAAW_OPTION_HIDDEN );          LaunchAppAndWait ( "", "sc delete tomcat7", LAAW_OPTION_HIDDEN );               /*-----------卸載tomcat8服務-------------------*/          LaunchAppAndWait ( "", "sc stop tomcat8", LAAW_OPTION_HIDDEN );          LaunchAppAndWait ( "", "sc delete tomcat8", LAAW_OPTION_HIDDEN );          /*-----------卸載tomcat9服務-------------------*/          LaunchAppAndWait ( "", "sc stop tomcat9", LAAW_OPTION_HIDDEN );          LaunchAppAndWait ( "", "sc delete tomcat9", LAAW_OPTION_HIDDEN );         case REPAIR:    FeatureReinstall();     endswitch;          // setup default status     SetStatusWindow(0, "");     Enable(STATUSEX);     StatusUpdate(ON, 100); end;          function addFileValue(szFileName, szSectionName, szKeyName, szNewValue) begin               if (AddProfString (szFileName, szSectionName, szKeyName,szNewValue) < 0) then          MessageBox(szFileName+"文件配置失敗,請手動更改"+szKeyName+"值爲"+szNewValue, SEVERE);      endif;                   end;        //--------------------------------------------------------------------------- // OnMoved // // The OnMoved event is called just before the InstallShield action // 'GeneratedMSIScript' is executed. //--------------------------------------------------------------------------- function OnMoved() begin               //配置文件       if(!MAINTENANCE)then         addFileValue(TARGETDIR+"TomcatService.bat","","set CATALINA_HOME",TARGETDIR+"apache-tomcat7-cas");     endif;          end;      
相關文章
相關標籤/搜索