InstallShield製作ASP安裝程式(3)

hljhrbsjf發表於2006-03-29

看人家用使用InstallShield製作ASP安裝程式(3)

(文件類別:) 2002-2-5

下面是建立WEB檔案和設定的例子需VBS檔案(有虛擬目錄設定,但沒有許可權設定).

////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-1999, InstallShield Software Corporation
// II SS (c) 1990-1996, InstallShield Corporation
// IIIIIII SSSSSS All Rights Reserved.
//
//
// This code is generated as a starting setup template. You should
// modify it to provide all necessary steps for your setup.
//
//
// 檔名: Setup.rul
//
// 描述: InstallShield script
//
// 註釋: This template script performs a basic setup. With minor
// modifications, this template can be adapted to create
// new, customized setups.
//
////////////////////////////////////////////////////////////////////////////////


// 包含的標頭檔案

#include "ifx.h" //不能移動

////////////////////// string defines ////////////////////////////

//////////////////// installation declarations ///////////////////

// ----- DLL function prototypes -----


// your DLL function prototypes

// ---- script function prototypes -----


// your script function prototypes
prototype CHK_serial(STRING,STRING);
prototype RegODBC(STRING);
prototype set_vod_liveaddress();
// your global variables
STRING szvodservername;
STRING szliveservername;


//////////////////////////////////////////////////////////////////////////////
//
// 函式: 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;
STRING szTitle, szMsg;
STRING szLicenseFile, szQuestion;
STRING svName, svCompany, svSerial;
STRING szFile;
STRING szTargetPath;
STRING szDir;
STRING szfolder;
STRING szComponents, szTargetdir;
//zy
STRING szDefault,svResult;
STRING sDBSERVERNAME;
OBJECT piisObj;
//zy
NUMBER nLevel;
LIST listStartCopy;
LIST list;
NUMBER nvSize;
STRING msg;
begin


//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));



nSetupType = TYPICAL;
TARGETDIR = "D:"^"cyclone2000";
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
svName = "";
svCompany = "";
svSerial = "";

Dlg_Start:
// beginning of dialogs label

Dlg_SdWelcome: //歡迎 對話方塊
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;

Dlg_SdLicense://軟體許可協議 對話方塊
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "";
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 = "";
szMsg = "";
nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
if (nResult = BACK) goto Dlg_SdLicense;

Dlg_SdRegisterUserEx://使用者資訊 對話方塊
szMsg = "";
szTitle = "";
nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial );
if (nResult = BACK) goto Dlg_SdShowInfoList;
//檢查序列號
if (CHK_serial(svCompany, svSerial)<0) then
goto Dlg_SdRegisterUserEx;
endif;
//檢查序列號完畢
Dlg_SdAskDestPath://安裝位置 對話方塊
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
TARGETDIR = szDir;
if (nResult = BACK) goto Dlg_SdRegisterUserEx;

Dlg_SetupType: //安裝型別 對話方塊
szTitle = "";
szMsg = "";
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_AskText ://設定資料庫伺服器 對話方塊
szTitle = "設定資料庫伺服器";
szMsg = "";
szQuestion="請輸入SQL SERVER(旋風2000)資料庫伺服器的主機名或IP地址";
szDefault="192.168.0.1";
SetDialogTitle(DLG_ASK_TEXT,szTitle);
nResult = AskText (szQuestion, szDefault, svResult);
sDBSERVERNAME = svResult;
if (nResult = BACK) goto Dlg_SdSelectFolder;
RegODBC(sDBSERVERNAME);

Dlg_SdStartCopy://開始複製檔案 對話方塊
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);
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_AskText;
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);

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
szCmdLine = SUPPORTDIR ^"mkwebdir.vbs "+"-c LocalHost -w 1 -v cyclone2000 -d "+ TARGETDIR ;
if (LaunchAppAndWait("WScript.exe", szCmdLine,WAIT) < 0) then
MessageBox ("不能建立WEB 虛擬目錄.",SEVERE);
endif;
set_vod_liveaddress();
szCmdLine = SUPPORTDIR ^"odbc.reg";
if (LaunchAppAndWait("regedit.exe", szCmdLine,WAIT) < 0) then
MessageBox ("不能配置ODBC.",SEVERE);
endif;
Disable(STATUSEX);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
szMsg2 = "請瀏覽本主機WEB伺服器上的 cyclone2000 虛擬目錄nn 例:n
szOption1 = "";
szOption2 = "";
szTitle = "旋風2000安裝完成";
SdFinishEx(szTitle,szMsg1,szMsg2,szOption1,szOption2,bOpt1,bOpt2);

szCmdLine = "
if (LaunchApp(PROGRAMFILES ^"Internet Explorer"^"IEXPLORE.EXE", szCmdLine) < 0) then
MessageBox ("不能開啟瀏覽器.",SEVERE);
endif;

return 0;
end;

///////////////////////////////////////////////////////////////////////////////
//
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/631872/viewspace-823710/,如需轉載,請註明出處,否則將追究法律責任。

相關文章