日期:2013-11-22  浏览次数:21004 次

//近期公司用ASP+SQL开发办公自动化OA,需要制作安装程序发行,此脚本是用IS9.0制作,以此共享,与各同仁交流学习
#define BITMAP_ID 1

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

prototype CreateWebSite(STRING,STRING); // 创建 IIS 站点
prototype CreateVirtualDir(STRING); // 创建虚拟目录
prototype CreateDataBase(STRING,STRING,STRING);//创建SQL数据库
prototype CheckIIS(); // 示例:检查系统是否安装IIS

STRING TMP_PRODUCT_NAME,TMP_PRODUCT_VERSION,TMP_COMPANY_NAME,TMP_PRODUCT_KEY,TMP_TITLE_CAPTIONBAR;
STRING globalstr,destdir,destsvr,destsa,destpw;
NUMBER nvFileHandle,nvFileHandlebak,asaline;
BOOL iscreatedb;
STRING nSetupType,szSQLsvr,szSQLusr,szSQLpwd,szSQLsvrDefault,szSQLusrDefault,szSQLpwdDefault;
STRING szADsvr,szADusr,szADpwd,szADsvrDefault,szADusrDefault,szADpwdDefault;
STRING szADDomain,szADOU,szADDomainDefault,szADOUDefault,ADDC1;
STRING svName, svCompany, svSerial;

function OnFirstUIBefore()

NUMBER nResult,nOpt,svEdit1,svEdit2;
STRING szTitle, szMsg,szBmpPath;
STRING szLicenseFile, szQuestion;
STRING szServerIP,szServerPort,szServerIPDefault,szServerPortDefault;

STRING szFile,szTargetPath,szDir,szfolder;
STRING szComponents, szTargetdir;
STRING szField1,szField2;
STRING szDefault,svResult;
OBJECT piisObj;
LIST list,listStartCopy;
NUMBER nLevel,nvSize;

begin

TMP_PRODUCT_NAME="XXX电子政务平台";
TMP_PRODUCT_VERSION="V2.0";
TMP_COMPANY_NAME="XXX公司";
TMP_PRODUCT_KEY="88888888";
TMP_TITLE_CAPTIONBAR="0";

szBmpPath=SUPPORTDIR^"left.bmp";
DialogSetInfo(DLG_INFO_ALTIMAGE, szBmpPath, FALSE); // 设置左边的图片
//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));
PlaceBitmap (szBmpPath, BITMAP_ID, 0, 0, FULLSCREEN);

//默认值设定
TARGETDIR = "C:"^"inetpub"^@FOLDER_NAME;
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
svName = "";
svCompany = "";
svSerial = "88888888";

if (CheckIIS()==1) then // 示例:检查系统是否安装IIS
//MessageBox ("已经安装了IIS,安装继续!",SEVERE);
goto Dlg_Start;
else
MessageBox ("该系统没有安装IIS,请先安装IIS!",WARNING);
goto end_all_install;//结束安装
endif;


Dlg_Start:// 开始对话框

Dlg_SdWelcome: //欢迎 对话框
szTitle = "欢迎安装使用 "+TMP_PRODUCT_NAME+" "+TMP_PRODUCT_VERSION;
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 = "用户信息注册";
svCompany = "XXX省";
svSerial = "XXX单位";
nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial );
if (nResult = BACK) goto Dlg_SdShowInfoList;
//检查序列号
//if (CHK_serial(svCompany, svSerial)<0) then
//goto Dlg_SdRegisterUserEx;