直播中
//////////////////////////////////////////////////////////////////////////////
//
// 函數(shù): 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); // 設(shè)置左邊的圖片
//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));
//默認(rèn)值設(shè)定
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: //歡迎 對話框
szTitle = "歡迎進(jìn)入";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense://軟件許可協(xié)議 對話框
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "許可協(xié)議";
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://用戶信息 對話框
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: //安裝類型 對話框
nSetupType = TYPICAL;
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_SelMode ://設(shè)置數(shù)據(jù)庫服務(wù)器 對話框
szTitle = "設(shè)置"+@PRODUCT_NAME+"的運(yùn)行模式";
szMsg = "請選擇軟件運(yùn)行的方式,極力推薦使用獨(dú)立站點(diǎn)方式運(yùn)行";
szField1="獨(dú)立站點(diǎn)方式運(yùn)行(自動創(chuàng)建新站點(diǎn))";
szField2="虛擬目錄方式運(yùn)行(自動創(chuàng)建虛擬目錄)";
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 ://設(shè)置數(shù)據(jù)庫服務(wù)器 對話框
szTitle = "設(shè)置IIS信息服務(wù)及數(shù)據(jù)庫服務(wù)器";
szMsg = "現(xiàn)在開始設(shè)置IIS系統(tǒng)";
szQuestion=" 請輸入本服務(wù)器的主機(jī)名或IP地址,安裝程序?qū)凑漳峁┑馁Y料設(shè)置IIS信息服務(wù)。如果您沒有填寫,安裝程序?qū)⒆詣犹^站點(diǎn)的創(chuàng)建!";
szServerIP="地址:";
szServerPort="端口:";
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 ://設(shè)置數(shù)據(jù)庫服務(wù)器 對話框
szTitle = "設(shè)置數(shù)據(jù)庫";
szMsg = "現(xiàn)在開始設(shè)置Microsoft SQL Server數(shù)據(jù)庫系統(tǒng)";
szQuestion=" 請輸入SQL SERVER數(shù)據(jù)庫服務(wù)器的用戶名和密碼,安裝程序?qū)凑漳喜教峁┑腎P地址和下面的用戶名和密碼創(chuàng)建和優(yōu)化數(shù)據(jù)庫系統(tǒng)。如果您提供的用戶名和密碼是錯誤的,安裝程序?qū)⒆詣犹^數(shù)據(jù)的設(shè)置!";
szSQLsvr="主機(jī)名:";
szSQLusr="用戶名:";
szSQLpwd="密碼:";
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://開始復(fù)制文件 對話框
szTitle = "開始復(fù)制文件";
szMsg = "點(diǎn)擊下一步開始復(fù)制文件";
listStartCopy = ListCreate( STRINGLIST );
ListAddString(listStartCopy,"用戶名:"+svName,AFTER);
ListAddString(listStartCopy,"公司名稱:"+svCompany,AFTER);
ListAddString(listStartCopy,"序列號:"+svSerial,AFTER);
ListAddString(listStartCopy,"目標(biāo)目錄:"+szDir,AFTER);
if (svEdit1=TRUE) then
ListAddString(listStartCopy,"IP地址:"+szServerIPDefault,AFTER);
ListAddString(listStartCopy,"端口號:"+szServerPortDefault,AFTER);
endif;
ListAddString(listStartCopy,"請確認(rèn)您填寫的信息,按下一步開始復(fù)制文件",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); // 開始創(chuàng)建 IIS 站點(diǎn)
endif;
if (svEdit2=TRUE) then
CreateVirtualDir("NetOA"); // 開始創(chuàng)建 IIS 站點(diǎn)
endif;
CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd); // 創(chuàng)建和優(yōu)化數(shù)據(jù)庫
return 0;
end;
//////////////////////////////////////////////////////////////////////////////
//
// 函數(shù): 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 ("不能安裝解碼程序,請聯(lián)系供應(yīng)商.",SEVERE);
endif;
Disable(STATUSEX);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
szMsg2 = "請瀏覽本主機(jī)WEB服務(wù)器上的 "+@PRODUCT_NAME+" 虛擬目錄\n\n 例:\n http://Localhost/";
szOption1 = "";
szOption2 = "";
szTitle = @PRODUCT_NAME+"安裝完成";
SdFinishEx(szTitle,szMsg1,szMsg2,szOption1,szOption2,bOpt1,bOpt2);
szCmdLine = "http://LocalHost";
//if (LaunchApp(PROGRAMFILES ^"Internet Explorer"^"IEXPLORE.EXE", szCmdLine) < 0) then
//MessageBox ("不能打開瀏覽器.",SEVERE);
//endif;
return 0;
end;
//////////////////////////
// 創(chuàng)建IIS站點(diǎn)
//////////////////////////
function CreateWebSite(szServerIPDefault,szServerPortDefault)
STRING szCmdLine,szWaitTxt;
begin
if ((szServerIPDefault = "") || (szServerPortDefault = "")) then
MessageBox ("您沒有設(shè)定"+@PRODUCT_NAME+"運(yùn)行的服務(wù)器IP地址或端口??!IIS信息服務(wù)設(shè)置失敗!\n請自行創(chuàng)建IIS站點(diǎn),并將主目錄設(shè)為:"+TARGETDIR,SEVERE);
else
szWaitTxt=" 正在創(chuàng)建IIS和設(shè)置站點(diǎn)....";
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 虛擬目錄,沒有找到 WScript.exe 或執(zhí)行腳本錯誤.",SEVERE);
endif;
SdShowMsg (szWaitTxt, FALSE);
endif;
return 0;
end;
//////////////////////////
// 創(chuàng)建虛擬目錄
//////////////////////////
function CreateVirtualDir(VirtualFolder)
STRING szCmdLine,szWaitTxt;
begin
if (VirtualFolder = "") then
MessageBox ("沒能讀取到虛擬目錄的名稱!請聯(lián)系系統(tǒng)供應(yīng)商!"+TARGETDIR,SEVERE);
else
szWaitTxt=" 正在創(chuàng)建"+@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 虛擬目錄,沒有找到 WScript.exe 或執(zhí)行腳本錯誤.",SEVERE);
endif;
SdShowMsg (szWaitTxt, FALSE);
endif;
return 0;
end;
//////////////////////////
// 創(chuàng)建和優(yōu)化數(shù)據(jù)庫
//////////////////////////
function CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd)
STRING szCmdLine,szWaitTxt;
begin
szWaitTxt=" 正在創(chuàng)建"+@PRODUCT_NAME+"所需數(shù)據(jù)庫....";
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 ("數(shù)據(jù)庫創(chuàng)建失??!請確您的系統(tǒng)中已安裝 Microsoft SQL Server 2000.\n如仍無法解決,請聯(lián)系系統(tǒng)供應(yīng)商!",SEVERE);
endif;
SdShowMsg (szWaitTxt, FALSE);
szWaitTxt=" 正在優(yōu)化"+@PRODUCT_NAME+"系統(tǒng)數(shù)據(jù)庫....";
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 ("數(shù)據(jù)庫優(yōu)化失??!您可以在 sql查詢分析器中執(zhí)行 \n use OASystem ; exec sp_updatestats \n完成!",SEVERE);
endif;
SdShowMsg (szWaitTxt, FALSE);
return 0;
end;