Use InstallShield to pack and install ASP programs

xiaoxiao2021-03-06  58

Use InstallShield to make ASP program packages, including SQL Server, IIS virtual directory settings, and more. Original url: http://www.viphot.com/infoview/Article_6838.html

Original extract:

Use InstallShield to make ASP software packaging and automatic installation

#include "ifx.h" // // // can not move with InstallShield to package ASP software and installed automatically // Original Author: Jia Jun (Jaron) // URL: http://www.jiangdu.net // Email: jaron@jdinfo.net // First published in Netease, ChinaASP, Asphouse // // Function: // 1. File Copy // 2. Optional Automatically set up a separate site (set IIS) // 3. Optional Automatically set up virtual site run (Set IIS) // 4. Set the directory readable, write and can run script // 5. Automatically create ODBC // 6. Automatically create or attach the SQL database in MDF format and optimize // 7. Automatically install Scriptencode decoder // This article only lists the Script section of InstallShield, there are two VBS files and other settings // test, please come http://www.jiangdu.net/bbs programming space Discussion / Prototype CreateDatabase (String, String, String); Prototype CreateWebsite (String, String); // Create IIS Site Prototype CreateVirtualDir (String); // Create a virtual directory

// // // Function: OnFirstUIBefore // // Event: FirstUIBefore event is sent when installation is run for the first // time on given machine In the handler installation usually displays // UI allowing end user to specify installation parameters.. After this // function returns, ComponentTransferData is called to perform file // transfer // /// function OnFirstUIBefore (NUMBER nResult, nSetupType, nOpt, svEdit1, svEdit2);. STRING szTitle, szMsg, szBmpPath; STRING szLicenseFile, szQuestion; STRING szServerIP, szServerPort, szServerIPDefault, szServerPortDefault; STRING szSQLsvr, szSQLusr, szSQLpwd, svSQLsvr, svSQLusr, svSQLpwd; STRING svName, svCompany, svSerial; STRING szFile, szTargetPath, szDir, szfolder; STRING szComponents, szTargetdir; STRING szField1, szField2; STRING szDefault, SvResult; Object Piisobj; List List, ListStartCopy; Number NlevEl, NVsize; Begin

SZBMPPATH = "C:" ^ "Temp" ^ "left.bmp"; DialogsetInfo (DLG_INFO_ALTIMAGE, SZBMPPATH, TRUE); // Set the left picture // to do: if you want to enable Background, Window Title, and Caption Bar, WINDOW TITLE, AND CAPTION BAR Title // settitle (@title_main, 24, white); // settitle (@title_captionbar, 0, backgroundcaption); // enable (fullwindowmode); // enable (background); // setColor (Background, RGB (0, 128 , 128)); // Default setting targetdir = "C:" ^ "inetpub" ^ "jaronsoft" ^ @ folder_name; szdir = targetdir; shell_Object_folder = @folder_name; svname = "Trial User"; svcompany = "JDInfo NetWork "; svserial =" 111-1111111 ";

DLG_Start: // Beginning of Dialogs Label

DLG_SDWELCOME: // Welcome dialog box sztitle = "Welcome to"; szmsg = ""; nresult = szmsg; if (nresult = back) goto dlg_start;

DLG_SDLICENSE: / / Software License Agreement dialog SzlicenseFile = SupportDir ^ "license.txt"; sztitle = "License Agreement"; SZMSG = ""; szquestion = ""; NRESULT = SDLICENSE (sztitle, szmsg, szquestion, szlicensefile; if (NRESULT = back) goto dlg_sdwelcome;

Dlg_SdShowInfoList: // readme file dialog szFile = SUPPORTDIR ^ "infolist.txt"; list = ListCreate (STRINGLIST); ListReadFromFile (list, szFile); szTitle = "README"; szMsg = ""; nResult = SdShowInfoList (szTitle, szMsg , list); ListDestroy (list); if (nresult = back) goto dlg_sdlicense;

DLG_SDREGISTERUSEREX: // User Information dialog SZMSG = ""; sztitle = "User Information"; NRESULT = SDREGISTERUSEREX (SZTITLE, SZMSG, SVNAME, SVCCCompany, SVSERIAL); if (NResult = BACK) GOTO DLG_SDSHOWINFOLIST; / / Check Serial Number / / if (chk_serial (svcompany, svserial <0) THEN / / GOTO DLG_SDREGISTERUSEREX; / / ENDIF; // Check the serial number DLG_SDaskDestPath: // Installation Location dialog SZTITLE = "Check serial number"; szmsg = ""; NRESULT = SDASKDESTPATH ​​(SZTITLE, SZMSG, SZDIR, 0); Targetdir = SZDIR; if (Nresult = BACK) GOTO DLG_SDREGISTERUSEREX; DLG_SETUPTYPE: // Installation Type dialog NSETUPTYPE = type = type = type = "Installation Type"; szmsg = "Please select you which needs to be installed by the way "; nResult = SetupType (szTitle, szMsg," ", nSetupType, 0); if (nResult = BACK) then goto Dlg_SdAskDestPath; else nSetupType = nResult; if (! nSetupType = CUSTOM) then szTargetPath = TARGETDIR NVSIZE = 0; ComponentCompareSizeRequired (Media, SztargetPath, nvsize); if (nvsize! = 0) Then MessageBox (szsdstr_notenough, warning); goto dlg_setupType; Endif; Endif; Endif;

DLG_SDComponenttree: // Dialog Box IF ((NResult = BACK) && (NSETUPTYPE! = Custom)) GOTO DLG_SETUPTYPE; SZTITLE = "Dialog"; szMsg = ""; sztargetdir = targetdir; szcomponents = ""; NLEVEL = 2; IF (NSETUPTYPE = Custom) THEN NRESULT = SDcomponenttree (Sztitle, SzMsg, Sztargetdir, Szcomponents, NLEVEL); if (NRESULT = BACK) GOTO DLG_SETUPTYPE; ENDIF;

Dlg_SdSelectFolder: // dialog szfolder = SHELL_OBJECT_FOLDER; szTitle = "folder"; szMsg = ""; nResult = SdSelectFolder (szTitle, szMsg, szfolder); SHELL_OBJECT_FOLDER = szfolder; if (nResult = BACK) goto Dlg_SdComponentTree;

DLG_SELMODE: // Setting the Database Server dialog Sztitle = "Set" @ product_name ""; szmsg = "Please select the software running, it is recommended to use the independent site mode to run"; szfield1 = "independent site mode operation ( Automatically create new sites) "; SZFIELD2 =" virtual directory operation (automatically created virtual directory) "; svedit1 = true; svedit2 = false; setDialogtitle (DLG_ASK_TEXT, SZTITLE); // DialogsetInfo (DLG_INFO_CHECKSELECTION," ", 1); NOPT = EXCLUSIVE; nResult = AskOptions (nOpt, szMsg, szField1, svEdit1, szField2, svEdit2); if (nResult = BACK) goto Dlg_SdSelectFolder; if (svEdit1 = FALSE) goto Dlg_SdStartCopy; Dlg_AskText: // settings database server dialog box szTitle = " Set IIS Information Service and Database Server "; SZMSG =" Now set the IIS system "; szquestion =" Please enter the host name or IP address of this server. The installer will set the IIS information service according to the information you provide. If you are not filled in The installer will automatically skip the creation of the site! "; SZServerip =" address: "; szserverport =" port: "; szserveripdefault =" 192.168.0.1 "; szserverportdefault =" 80 "; setDialogtitle (DLG_ASK_Text, sztitle; nresultle); NRESULT = SDShowdlgedit2 (SZTITLE, SZQuestion, Sz ServerIP, SZSERVERPORT, SZSERVERIPDEFAULT, SZSERVERPORTDEFAULT); if (nresult = back) Goto DLG_SELMODE

DLG_ASKSQL: // Setting the Database Server dialog SZTITLE = "Setting the database"; szmsg = "Now set the Microsoft SQL Server database system"; szquestion = "Please enter the username and password of the SQL Server database server, the installer will follow you The supplied IP address and the following username and password create and optimize the database system. If the username and password you provide are wrong, the installer will automatically skip the settings of the data! "; Szsqlsvr =" host name: "; szsqlusr =" username: "; szSQLpwd =" password: "; svSQLsvr =" localhost "; svSQLusr =" sa "; szSQLpwd =" "; setDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit3 (szTitle, szQuestion, szSQLsvr, szSQLusr, szSQLpwd, SVSQLSVR, SVSQLUSR, SVSQLPWD; IF (NRESULT = BACK) GOTO DLG_SELMODE;

DLG_SDSTARTCOPY: / / Start Copy File Dialog Sztitle = "Start Copy File"; SZMSG = "Click Next to Copy File"; ListStartCopy = ListCreate (StringList); ListAddString (ListStartCopy, "User Name:" svname, after); ListAddString (listStartCopy, "name:" svCompany, AFTER); ListAddString (listStartCopy, "SEQ ID NO:" svSerial, AFTER); ListAddString (listStartCopy, "target directory:" szDir, AFTER); if (svEdit1 = TRUE ) then ListAddString (listStartCopy, "IP address:" szServerIPDefault, AFTER); ListAddString (listStartCopy, "port number:" szServerPortDefault, AFTER); endif; ListAddString (listStartCopy, "Please make sure you fill in the information, press Next to begin copy the file ", AFTER); nResult = SdStartCopy (szTitle, szMsg, listStartCopy); ListDestroy (listStartCopy); if (nResult = BACK) goto Dlg_AskText; // setup default status SetStatusWindow (0," "); Enable (STATUSEX); StatusUpdate (ON, 100); if (svEdit1 = TRUE) then CreateWebSite (szServerIPDefault, szServerPortDefault); // start creating the IIS site endif; if (svEdit2 = TRUE) then CreateVirtualDir ( "NetOA"); // start creating the IIS site endif CreatedTabase (SVSQLSVR, SVSQLUSR, SVSQLPWD); // Create and optimize database Return 0; end; // // function: o nFirstUIAfter // // Event: FirstUIAfter event is sent after file transfer, when installation // is run for the first time on given machine In this event handler // installation usually displays UI that will inform end user that // installation has been. Completed successfully. //// Function onfirstuiafter () String Sztitle, Szmsg1, Szmsg2, SzOption1, Szoption2, Szcmdline; Number Bopt1, Bopt2;

Begin // set_vod_liveaddress ();

Szcmdline = supportdir ^ "SCE10chs.exe"; if (Launchappandwait (Szcmdline, "/ q", Wait) <0) Then MessageBox ("You cannot install the decoder, please contact the supplier.", severe); endif; disable ); bopt1 = false; bopt2 = false; szmsg1 = sdloadstring (ifx_sdfinish_msg1); SZMSG2 = "Please browse" @ Product_name "virtual directory / N / N: / n http:// localhost /" ; Szoption1 = ""; szoption2 = ""; sztitle = @ product_name "installation completion"; SDFinishex (Sztitle, Szmsg1, Szmsg2, SzOption1, SzOption2, Bopt1, Bopt2);

Szcmdline = "http: // localhost"; // if (Programfiles ^ "Internet Explorer" ^ "ipplore.exe", szcmdline) <0) THEN // MessageBox ("You cannot open your browser.", severage); // Endif;

RETURN 0;

// // Create IIS site // function CreateWebSite (szServerIPDefault, szServerPortDefault) STRING szCmdLine, szWaitTxt; begin if ((szServerIPDefault = "") || (szServerPortDefault = "")) then MessageBox ( "you do not set" @ Product_name "Run server IP address or port !! IIS information service settings failed! / N Please create an IIS site yourself and set the home directory to:" targetdir, severe); else szwaittxt = "is creating an IIS and setup site. ... "; szwaittxt, true); delay (2); szcmdline = supportdir ^" mkw3site.vbs " " -r " targetdir " -i " szserveripdefault " -o " SZSERVERPORTDEFAULT " -t " @Product_name; if ("Wscript.exe", Szcmdline, Wait) The MessageBox ("You cannot establish a web virtual directory, no wscript.exe or execute script errors.", Seved; sdif; sdif; szwaittxt , False; Endif; Return 0;

// // Create a virtual directory // function createvirtualdir (VirtualFolder) String szcmdline, szwaittxt; begin if (VirtualFolder = "") Then MessageBox ("Cannot read the name of the virtual directory! Please contact the system supplier!" Targetdir , Severe); Else Szwaittxt = "Create" @ product_name "virtual directory ...."; sdshowmsg (szwaittxt, true); delay (2); szcmdline = supportdir ^ "mkwebdir.vbs" "-w 1 -V / " VirtualFolder " / ", /" Targetdir "/" "; if (LaunchappandWait (" Wscript.exe ", Szcmdline, Wait) The MessageBox (" You cannot establish a web virtual directory, no found WScript.exe or execution script error. ", Seve); endif; szwaittxt, false; endif; return 0;

转载请注明原文地址:https://www.9cbs.com/read-113379.html

New Post(0)