Use InstallShield to make ASP software packaging and automatic installation

zhaozj2021-02-17  52

I often see a friend asking questions about the installation of the ASP program. I happen to see an article today, I will share with everyone.

ASP packaged software and installed automatically with the InstallShield 2002: 3: 15 #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 // message: jaron@jdinfo.net // First in Netease, ChinaASP, Asphouse // // Function: // 1. File Copy // 2. Optional Automatically set up a stand-alone site run (Set IIS) // 3. Optional Automatically setup virtual site run (set IIS) // 4. Sets the directory readable, written to run script // 5. Automatically create ODBC // 6. Automatically create or attach the SQL database in the MDF format and optimize // 7. Automatically install the ScriptenCode decoder // This article lists only the Script section of InstallShield, and there are two VBS files and other settings // test processes. Can't come http://www.jiangdu.net/bbs programming space version discussion // prototype createDatabase (String, string, string); prototype createwebsite (string, string); // Create an 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. Instaltallation parameters. After this // Function Returns, ComponentTransferdata IS Called to Perform File // Transfer. /// Function ONFIRSTUIBEFORE () Number N Result, 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 title // settitle (@

Title_main, 24, white; // settitle (@title_captionbar, 0, backgroundcaption); // enable (fullwindowmode); // enable (background); // setColor (BACKGROUND, RGB (0, 128)); / / Default value 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 = SDWELCOME (SZTITLE, 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, svCompany, 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 Sequence Number "; szmsg =" "; nresult = sdaskdestpath (sztitle, szmsg, szdir, 0); targetdir = szdir;

IF (NResult = BACK) GOTO DLG_SDREGISTERUSEREX; DLG_SETUPTYPE: / / Installation Type dialog NSETUPTYPE = type = type = "Installation Type"; szmsg = "Please select which way you need to install"; 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_NotEnoughSpace, WARNING); goto Dlg_SetupType; endif; endif; endif; Dlg_SdComponentTree: // dialog if ((nResult = BACK) && (nSetupType = CUSTOM!)) goto Dlg_SetupType; szTitle = "dialogue block "; 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 "Run mode"; szmsg = "Please select the software running, it is recommended to use independence Site mode operation "; SZFIELD1 =" independent site mode runs (automatically creates new sites) "; SZFIELD2 =" virtual directory operation (automatically created virtual directory) "; svedit1 = true; svedit2 = false; setDialogtitle (DLG_ASK_Text, sztitle); // DialogsetInfo (DLG_INFO_CHECKSELECTION, "", 1); NRESULT = Exclusive; NRESULT = askOptions (NOPT, SZMSG, SZFIELD1, SVEDIT1, SZFIELD2, SVEDIT2); if (NResult =

BACK) GOTO DLG_SDSELECTFOLDER; if (svedit1 = false) goto dlg_sdstartcopy; dlg_asktext: // Setting the database server dialog SZTITLE = "Setting IIS Information Service and Database Server"; szmsg = "Now set 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 out, 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); nResult = SdShowDlgEdit2 (szTitle, szQuestion, szServerIP, 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 your username and password are wrong, the installer will automatically skip the settings of the data! "; szsqlsvr =" host name: "; szsqlusr =" username: "; szsqlpwd =" password: "; svsqlsvr =" localhost "; szsqlusr =" 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 copying files dialog box szTitle = "start copying files"; szMsg = "click Next to begin copying files "; listStartCopy = ListCreate (STRINGLIST); ListAddString (listStartCopy," user name: " svName, AFTER); ListAddString (listStartCopy," the company name: " svCompany, AFTER); ListAddString (listStartCopy," sequence number: " 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, click Next to begin copying files", 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: OnFirstUIAfter // // 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 decoding program, please contact the supplier. ", Severe; endif; disable (statusex); 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 is complete"; SdFinishEx (szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); szCmdLine = "http: // LocalHost"; // if (LaunchApp (PROGRAMFILES ^ "Internet Explorer" ^ "ipplore.exe", szcmdline) <0) THEN // ME ssageBox ( "can not open the browser.", SEVERE); // endif; return 0; end; // // create IIS sites // function CreateWebSite (szServerIPDefault, szServerPortDefault) STRING szCmdLine, szWaitTxt; begin if ((szServerIPDefault = " ") || (SZSERVERPORTDEFAULT =")) THEN MessageBox ("You do not set" @ product_name "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 =" IIS and Settings Sites .... "; SDShowMsg (Szwaittxt, true); delay (2); szcmdline = supportdir ^ "MKW3Site.vbs" "

-r " TARGETDIR " -i " szServerIPDefault " -o " szServerPortDefault " -t " @ PRODUCT_NAME; if (LaunchAppAndWait (" WScript.exe ", szCmdLine, WAIT) <0) then MessageBox (" can not establish a virtual WEB Directory, no WScript.exe or execute script error. ", Seve); endif; szwaittxt, false; endif; return 0; end; // creates 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 vendor! " Targetdir, severe); else szwaittxt =" Create " @ product_name " virtual Directory .... "; sdshowmsg (szwaittxt, true); delay (2); szcmdline = supportdir ^" mkwebdir.vbs " " -w 1 -V / " virtualfolder " / ", /" " targetdir " / ""; if ("Wscript.exe", Szcmdline, Wait) The MessageBox ("You cannot establish a web virtual directory, no wscript.exe or execute script error.", severe; endif; sdshowmsg szWaitTxt, FALSE); endif; return 0; end; // // create and optimize database // function CreateDataBase (svSQLsvr, svSQLusr, svSQLpwd) STRING szCmdLine, szWaitTxt; begin szWaitTxt = "being created" @ PRODUCT_NAME "desired database .... "; szwaittxt, true); DELAY (2) szcmdline = "/ u" svsqlusr "/ p" svsqlpwd "/ s" svsqlsvr "/ q /" exec sp_attach_db n'oasystem ', n' " supportdir ^" oasystem_data.mdf '/ "; if ( Launchappandwait ("Osql.exe", Szcmdline, Wait) <0) The MessageBox ("Database creation failed! Please ensure that Microsoft SQL Server 2000./n is still unable to resolve, please contact your system supplier! ", Severe); Endif; SDShowmsg (Szwaittxt, False);

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

New Post(0)