¥ÎInstallShield ¶i¦æ ASP ³nÅ骺¥´¥]©M¦Û°Ê¦w¸Ë «e¨Ç®ÉԬݨì³o½g¤å³¹¡A¹ï¤ñ¤F¦Û¤v©M§@ªÌªº¹ê²{¤èªk¡A·Pı¦³¤@©wªº°Ñ¦Ò»ùÈ¡A¤j®a¤£§«¬Ý¬Ý¡C §A¥i¥H¥ý§Q¥ÎInstallShieldªº ¦w¸Ëµ{§ÇÂQ¾É§¹¦¨°ò¥»ªº®Ø¬[¡AµM«á±NScript½Æ»s¶i¥h¡C ¥ÎInstallShield ¶i¦æ ASP ³nÅ骺¥´¥]©M¦Û°Ê¦w¸Ë(Jaronì³Ð) §@ªÌ: Jaron ÂIÀ»³s±µÀ˵ø§@ªÌ¸Ô²Ó«H®§ ²¤¶: ¥ÎInstallShield ¶i¦æ ASP ³nÅ骺¥´¥]©M¦Û°Ê¦w¸Ë(ì³Ð) #include "ifx.h" //¤£¯à²¾°Ê ////////////////////////////////////////////////////////////////////////////// // ¥ÎInstallShield ¶i¦æ ASP ³nÅ骺¥´¥]©M¦Û°Ê¦w¸Ë // ì³Ð§@ªÌ: ¸ë«T (Jaron) // ºô§}: http://www.jiangdu.net // ¶l¥ó: jaron@jdinfo.net // º¦¸µoªí©óºô©ö¡AChinaASP,ASPHouse ////////////////////////////////////////////////////////////////////////////// // ¥\¯à¡G // 1.¤å¥ó½Æ»s // 2.¥i¿ï¦Û°Ê³]¸m¿W¥ß¯¸ÂI°õ¦æ(³]¸mIIS) // 3.¥i¿ï¦Û°Ê³]¸mµêÀÀ¯¸ÂI°õ¦æ(³]¸mIIS) // 4.³]¸m¥Ø¿ý¥iŪ¡A¥i¼g¤Î¥i°õ¦æ¸}¥» // 5.¦Û°Ê«Ø¥ßODBC // 6.¦Û°Ê«Ø¥ß©Îªþ¥[MDF®æ¦¡ªºSQL¸ê®Æ®w ¨ÃÀu¤Æ // 7.¦Û°Ê¦w¸Ë ScriptEncode ¸Ñ½Xµ{§Ç // ¥»¤å¶È¦C¥X¤F InstallShield ªº Script ³¡¤À,ÁÙ¦³¨âÓ VBS ¤å¥ó¤Î¨ä¥L³]¸m // ´ú¸Õ¹Lµ{¤¤¦³¥ô¦ó°ÝÃD¡A½Ð¨Ó http://www.jiangdu.net/bbs ½sµ{ªÅ¶¡ª© °Q½× ////////////////////////////////////////////////////////////////////////////// prototype CreateDataBase(STRING,STRING,STRING); prototype CreateWebSite(STRING,STRING); // «Ø¥ß IIS ¯¸ÂI prototype CreateVirtualDir(STRING); // «Ø¥ßµêÀÀ¥Ø¿ý ////////////////////////////////////////////////////////////////////////////// // // ¨ç¼Æ: OnFirstUIBefore // // ¨Æ¥ó: 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); // ³]¸m¥ªÃ䪺¹Ï¤ù //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, 128)); //¹w³]ȳ]©w TARGETDIR = "C:"^"inetpub"^"JaronSoft"^@FOLDER_NAME; szDir = TARGETDIR; SHELL_OBJECT_FOLDER = @FOLDER_NAME; svName = "¸Õ¥Îª©¥Î¤á"; svCompany = "JDinfo Network"; svSerial = "111-1111111"; Dlg_Start: // beginning of dialogs label Dlg_SdWelcome: //Åwªï ¹ï¸Üµøµ¡ szTitle = "Åwªï¶i¤J"; szMsg = ""; nResult = SdWelcome( szTitle, szMsg ); if (nResult = BACK) goto Dlg_Start; Dlg_SdLicense://³nÅé³\¥i¨óij ¹ï¸Üµøµ¡ szLicenseFile = SUPPORTDIR ^ "license.txt"; szTitle = "³\¥i¨óij"; szMsg = ""; szQuestion = ""; nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile ); if (nResult = BACK) goto Dlg_SdWelcome; Dlg_SdShowInfoList://readme¤å¥ó ¹ï¸Üµøµ¡ 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://¥Î¤á«H®§ ¹ï¸Üµøµ¡ szMsg = ""; szTitle = "¥Î¤á«H®§"; nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial ); if (nResult = BACK) goto Dlg_SdShowInfoList; //Àˬd§Ç¦C½X //if (CHK_serial(svCompany, svSerial)<0) then //goto Dlg_SdRegisterUserEx; //endif; //Àˬd§Ç¦C½X§¹²¦ Dlg_SdAskDestPath://¦w¸Ë¦ì¸m ¹ï¸Üµøµ¡ szTitle = "Àˬd§Ç¦C½X"; szMsg = ""; nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 ); TARGETDIR = szDir; if (nResult = BACK) goto Dlg_SdRegisterUserEx; Dlg_SetupType: //¦w¸ËÃþ«¬ ¹ï¸Üµøµ¡ nSetupType = TYPICAL; szTitle = "¦w¸ËÃþ«¬"; szMsg = "½Ð¿ï¾Ü±z»Ýn«öþºØ¤è¦¡¦w¸Ë"; 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: //¹ï¸Üµøµ¡ if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType; szTitle = "¹ï¸Üµøµ¡"; 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://¹ï¸Üµøµ¡ szfolder = SHELL_OBJECT_FOLDER; szTitle = "¸ê®Æ§¨"; szMsg = ""; nResult = SdSelectFolder( szTitle, szMsg, szfolder ); SHELL_OBJECT_FOLDER = szfolder; if (nResult = BACK) goto Dlg_SdComponentTree; Dlg_SelMode ://³]¸m¸ê®Æ®wªA°È¾¹ ¹ï¸Üµøµ¡ szTitle = "³]¸m"+@PRODUCT_NAME+"ªº°õ¦æ¼Ò¦¡"; szMsg = "½Ð¿ï¾Ü³nÅé°õ¦æªº¤è¦¡¡A·¥¤O±ÀÂ˨ϥοW¥ß¯¸ÂI¤è¦¡°õ¦æ"; szField1="¿W¥ß¯¸ÂI¤è¦¡°õ¦æ(¦Û°Ê«Ø¥ß·s¯¸ÂI)"; szField2="µêÀÀ¥Ø¿ý¤è¦¡°õ¦æ(¦Û°Ê«Ø¥ßµêÀÀ¥Ø¿ý)"; 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 ://³]¸m¸ê®Æ®wªA°È¾¹ ¹ï¸Üµøµ¡ szTitle = "³]¸mIIS«H®§ªA°È¤Î¸ê®Æ®wªA°È¾¹"; szMsg = "²{¦b¶}©l³]¸mIIS¨t²Î"; szQuestion=" ½Ð¿é¤J¥»ªA°È¾¹ªº¥D¾÷¦W©ÎIP¦a§},¦w¸Ëµ{§Ç±N«ö·Ó±z´£¨Ñªº¸ê®Æ³]¸mIIS«H®§ªA°È¡C¦pªG±z¨S¦³¶ñ¼g¡A¦w¸Ëµ{§Ç±N ¦Û°Ê¸õ¹L¯¸ÂIªº«Ø¥ß¡I"; szServerIP="¦a§}¡G"; szServerPort="Port¡G"; 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 ://³]¸m¸ê®Æ®wªA°È¾¹ ¹ï¸Üµøµ¡ szTitle = "³]¸m¸ê®Æ®w"; szMsg = "²{¦b¶}©l³]¸mMicrosoft SQL Server¸ê®Æ®w¨t²Î"; szQuestion=" ½Ð¿é¤JSQL SERVER¸ê®Æ®wªA°È¾¹ªº¥Î¤á¦W©M±K½X,¦w¸Ëµ{§Ç±N«ö·Ó±z¤W¨B´£¨ÑªºIP¦a§}©M¤U±ªº¥Î¤á¦W©M±K½X«Ø¥ß ©MÀu¤Æ¸ê®Æ®w¨t²Î¡C¦pªG±z´£¨Ñªº¥Î¤á¦W©M±K½X¬O¿ù»~ªº¡A¦w¸Ëµ{§Ç±N¦Û°Ê¸õ¹L¸ê®Æªº³]¸m¡I"; szSQLsvr="¥D¾÷¦W¡G"; szSQLusr="¥Î¤á¦W¡G"; szSQLpwd="±K½X¡G"; 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://¶}©l½Æ»s¤å¥ó ¹ï¸Üµøµ¡ szTitle = "¶}©l½Æ»s¤å¥ó"; szMsg = "ÂIÀ»¤U¤@¨B¶}©l½Æ»s¤å¥ó"; listStartCopy = ListCreate( STRINGLIST ); ListAddString(listStartCopy,"¥Î¤á¦W¡G"+svName,AFTER); ListAddString(listStartCopy,"¤½¥q¦WºÙ¡G"+svCompany,AFTER); ListAddString(listStartCopy,"§Ç¦C½X¡G"+svSerial,AFTER); ListAddString(listStartCopy,"¥Ø¼Ð¥Ø¿ý¡G"+szDir,AFTER); if (svEdit1=TRUE) then ListAddString(listStartCopy,"IP¦a§}¡G"+szServerIPDefault,AFTER); ListAddString(listStartCopy,"Port¸¹¡G"+szServerPortDefault,AFTER); endif; ListAddString(listStartCopy,"½Ð½T»{±z¶ñ¼gªº«H®§¡A«ö¤U¤@¨B¶}©l½Æ»s¤å¥ó",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); // ¶}©l«Ø¥ß IIS ¯¸ÂI endif; if (svEdit2=TRUE) then CreateVirtualDir("NetOA"); // ¶}©l«Ø¥ß IIS ¯¸ÂI endif; CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd); // «Ø¥ß©MÀu¤Æ¸ê®Æ®w return 0; end; ////////////////////////////////////////////////////////////////////////////// // // ¨ç¼Æ: OnFirstUIAfter // // ¨Æ¥ó: 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 ("¤£¯à¦w¸Ë¸Ñ½Xµ{§Ç¡A½ÐÁpô¨ÑÀ³°Ó.",SEVERE); endif; Disable(STATUSEX); bOpt1 = FALSE; bOpt2 = FALSE; szMsg1 = SdLoadString(IFX_SDFINISH_MSG1); szMsg2 = "½ÐÂsÄý¥»¥D¾÷WEBªA°È¾¹¤Wªº "+@PRODUCT_NAME+" µêÀÀ¥Ø¿ý\n\n ¨Ò¡G\n http://Localhost/ szOption1 = ""; szOption2 = ""; szTitle = @PRODUCT_NAME+"¦w¸Ë§¹¦¨"; SdFinishEx(szTitle,szMsg1,szMsg2,szOption1,szOption2,bOpt1,bOpt2); szCmdLine = "http://LocalHost"; //if (LaunchApp(PROGRAMFILES ^"Internet Explorer"^"IEXPLORE.EXE", szCmdLine) < 0) then //MessageBox ("¤£¯à¶}±ÒÂsÄý¾¹.",SEVERE); //endif; return 0; end; ////////////////////////// // «Ø¥ßIIS¯¸ÂI ////////////////////////// function CreateWebSite(szServerIPDefault,szServerPortDefault) STRING szCmdLine,szWaitTxt; begin if ((szServerIPDefault = "") || (szServerPortDefault = "")) then MessageBox ("±z¨S¦³³]©w"+@PRODUCT_NAME+"°õ¦æªºªA°È¾¹IP¦a§}©ÎPort¡I¡IIIS«H®§ªA°È³]¸m¥¢±Ñ¡I\n½Ð¦Û¦æ«Ø¥ßIIS¯¸ÂI¡A ¨Ã±N¥D¥Ø¿ý³]¬°¡G"+TARGETDIR,SEVERE); else szWaitTxt=" ¥¿¦b«Ø¥ßIIS©M³]¸m¯¸ÂI...."; 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 ("¤£¯à«Ø¥ßWEB µêÀÀ¥Ø¿ý¡A¨S¦³§ä¨ì WScript.exe ©Î°õ¦æ¸}¥»¿ù»~.",SEVERE); endif; SdShowMsg (szWaitTxt, FALSE); endif; return 0; end; ////////////////////////// // «Ø¥ßµêÀÀ¥Ø¿ý ////////////////////////// function CreateVirtualDir(VirtualFolder) STRING szCmdLine,szWaitTxt; begin if (VirtualFolder = "") then MessageBox ("¨S¯àŪ¨ú¨ìµêÀÀ¥Ø¿ýªº¦WºÙ¡I½ÐÁpô¨t²Î¨ÑÀ³°Ó¡I"+TARGETDIR,SEVERE); else szWaitTxt=" ¥¿¦b«Ø¥ß"+@PRODUCT_NAME+"ªºµêÀÀ¥Ø¿ý...."; SdShowMsg (szWaitTxt, TRUE); Delay(2); szCmdLine = SUPPORTDIR ^"mkwebdir.vbs "+" -w 1 -v \""+VirtualFolder+"\",\""+ TARGETDIR+"\"" ; if (LaunchAppAndWait("WScript.exe", szCmdLine,WAIT) < 0) then MessageBox ("¤£¯à«Ø¥ßWEB µêÀÀ¥Ø¿ý¡A¨S¦³§ä¨ì WScript.exe ©Î°õ¦æ¸}¥»¿ù»~.",SEVERE); endif; SdShowMsg (szWaitTxt, FALSE); endif; return 0; end; ////////////////////////// // «Ø¥ß©MÀu¤Æ¸ê®Æ®w ////////////////////////// function CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd) STRING szCmdLine,szWaitTxt; begin szWaitTxt=" ¥¿¦b«Ø¥ß"+@PRODUCT_NAME+"©Ò»Ý¸ê®Æ®w...."; SdShowMsg (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) then MessageBox ("¸ê®Æ®w«Ø¥ß¥¢±Ñ¡I½Ð½T±zªº¨t²Î¤¤¤w¦w¸Ë Microsoft SQL Server 2000.\n¦p¤´µLªk¸Ñ¨M¡A½ÐÁpô¨t²Î¨ÑÀ³ °Ó¡I",SEVERE); endif; SdShowMsg (szWaitTxt, FALSE); szWaitTxt=" ¥¿¦bÀu¤Æ"+@PRODUCT_NAME+"¨t²Î¸ê®Æ®w...."; SdShowMsg (szWaitTxt, TRUE); Delay(2); szCmdLine = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q \"use OASystem ; exec sp_updatestats\""; if (LaunchAppAndWait("osql.exe", szCmdLine,WAIT) < 0) then MessageBox ("¸ê®Æ®wÀu¤Æ¥¢±Ñ¡I±z¥i¥H¦b sql¬d¸ß¤ÀªR¾¹¤¤°õ¦æ \n use OASystem ; exec sp_updatestats \n§¹¦¨¡I",SEVERE); endif; SdShowMsg (szWaitTxt, FALSE); return 0; end; |