function OnFirstUIAfter() STRING szTitle
,
szMsg1
,
szMsg2
,
szOpt1
,
szOpt2
;
NUMBER bvOpt1
,
bvOpt2
;
NUMBER bShowUpdateServiceDlg
;
STRING szWaitText
;
STRING szServiceName
;
NUMBER svServiceState
;
STRING szMsde2000
,
szCmdLine
,
szStartServiceArgs
;
begin // 如果安装程序以“维护”模式启动 if (MAINTENANCE) then goto EndProcess
;
endif
;
// 检查系统是否安装了 MSDE
2000
SP4 szWaitText
=
"
正在检查系统是否安装了 MSDE2000 SP4 …….
"
;
SdShowMsg( szWaitText
,
TRUE)
;
szServiceName
=
"
MSSQLSERVER
"
;
if(ServiceGetServiceState(szServiceName
,
svServiceState) < ISERR_SUCCESS) then // 没有安装 MSDE,转安装处理 goto InstallMSDE
;
endif
;
goto StartMSDE
;
InstallMSDE: // 安装数据库服务 szWaitText
=
"
正在安装 MSDE2000 SP4。这个过程需要几分钟,请稍等
"
;
SdShowMsg(szWaitText
,
TRUE)
;
szMsde2000
=
SRCDIR ^
"
MSDE
"
^
"
setup.exe
"
;
// 将 MSDE
2000
SP4 安装到系统 Program File 目录下 szCmdLine
=
"
TARGETDIR=
""
+ PROGRAMFILES +
"
"
/q
"
;
if(LaunchAppAndWait(szMsde2000
,
szCmdLine
,
LAAW_OPTION_WAIT|LAAW_OPTION_MAXIMIZED) <
0
) then MessageBox (
"
安装 MSDE2000 SP4 失败,请联系系统管理员!
"
,
SEVERE)
;
goto EndProcess
;
endif
;
StartMSDE: // 启动 MSDE2000 服务 szWaitText
=
"
正在启动 MSDE2000 SP4 …….
"
;
SdShowMsg( szWaitText
,
TRUE)
;
// 安装了 MSDE
2000
,
试着启动服务 szStartServiceArgs
=
""
;
if(svServiceState !
=
SERVICE_RUNNING) then if (ServiceStartService (szServiceName
,
szStartServiceArgs) < ISERR_SUCCESS ) then MessageBox (
"
启动服务
"
+ szServiceName +
"
出错。
"
,
SEVERE)
;
goto EndProcess
;
endif
;
endif
;
// 加载用户数据库 szWaitText
=
"
正在创建所需数据库.
"
;
SdShowMsg(szWaitText
,
TRUE)
;
Delay(
2
)
;
// 先试着分离先前已经加载的数据库 szCmdLine
=
"
-E -Q
"
exec exec sp_detach_db GEChargeLicence
""
;
if(LaunchAppAndWait(
"
osql.exe
"
,
szCmdLine
,
LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN) <
0
) then MessageBox (
"
分离原来的数据库失败!请确认系统中已安装 MSDE 2000 SP4 并且服务已启动。如问题仍无法解决,请与联系统管理员联系!
"
,
SEVERE)
;
endif
;
// 将数据文件复制到程序安装目录 CreateDir( TARGETDIR ^
"
Data
"
)
;
CopyFile( SRCDIR ^
"
Data
"
^
"
GEChargeLicence.mdf
"
,
TARGETDIR ^
"
Data
"
^
"
GEChargeLicence.mdf
"
)
;
CopyFile( SRCDIR ^
"
Data
"
^
"
GEChargeLicence.ldf
"
,
TARGETDIR ^
"
Data
"
^
"
GEChargeLicence.ldf
"
)
;
// 附加数据库 szCmdLine
=
"
-E -Q
"
exec sp_attach_db 'GEChargeLicence'
,
'
"
+ TARGETDIR ^
"
Data
"
^
"
GEChargeLicence.mdf'
,
'
"
+ TARGETDIR ^
"
Data
"
^
"
GEChargeLicence.ldf'
""
;
if (LaunchAppAndWait(
"
osql.exe
"
,
szCmdLine
,
LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN) <
0
) then MessageBox (
"
数据库创建失败!请确认系统中已安装 MSDE 2000 SP4 并且服务已启动。如问题仍无法解决,请与联系统管理员联系!
"
,
SEVERE)
;
endif
;
SdShowMsg(szWaitText
,
FALSE)
;
EndProcess: // 以下代码是系统自动插入的 ShowObjWizardPages(NEXT)
;
szTitle
=
""
;
szMsg1
=
""
;
szMsg2
=
""
;
szOpt1
=
""
;
szOpt2
=
""
;
bvOpt1
=
FALSE
;
bvOpt2
=
FALSE
;
// Set this to true if you have the update service enabled
,
and if you want to check for updates. // Note: the ISUS Starter Edition does not support checking for updates programatically. So
,
// only set this to true if you have at least the ISUS Professional Edition. bShowUpdateServiceDlg
=
FALSE
;
//{{IS_SCRIPT_TAG(Dlg_SdDinishEx) if ( BATCH_INSTALL ) then SdFinishReboot ( szTitle
,
szMsg1
,
SYS_BOOTMACHINE
,
szMsg2
,
0
)
;
else // If the update service is enabled
,
show finish dialog that includes // update check option. if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then if( SdFinishUpdateEx( szTitle
,
szMsg1
,
szMsg2
,
szOpt1
,
szOpt2
,
TRUE ) ) then // Don't check for updates in silent mode. if( MODE !
=
SILENTMODE ) then UpdateServiceCheckForUpdates(
""
,
FALSE )
;
endif
;
endif
;
else SdFinish ( szTitle
,
szMsg1
,
szMsg2
,
szOpt1
,
szOpt2
,
bvOpt1
,
bvOpt2 )
;
endif
;
endif
;
//}}IS_SCRIPT_TAG(Dlg_SdDinishEx) end
;
按F7 制作安装影像。生成的安装影像文件位于 [盘符:]/InstallShield Express Projects/[安装项目名称]/Media/cdrom/Disk Images/Disk1 5、向影像中添加 MSDE 2000 SP4 的安装文件。 请先参照 MSDE 2000 ReadmeSql2k32desksp4.htm 中《4.1 再分发 MSDE 2000 SP4》的说明。 打开文件夹 [盘符:]/InstallShield Express Projects/[安装项目名称]/Media/cdrom/Disk Images/Disk1, 然后创建两个子文件 MSDE 和 Data 。 [盘符:]/InstallShield Express Projects/[安装项目名称]/Media/cdrom/Disk Images/Disk1/MSDE 用于存放 MSDE 2000 SP4 安装文件; [盘符:]/InstallShield Express Projects/[安装项目名称]/Media/cdrom/Disk Images/Disk1/Data 用于存放你要安装的数据库文件; 说明:MSDE 2000 ReadmeSql2k32desksp4.htm 中《4.1 再分发 MSDE 2000 SP4》中的说明并太确切。实际上,为了让 MSDE 2000 SP4 的Setup.exe 正确运行,还需要将所下载并解压 MSDE 2000 SP4 中 *.dll 和 *.rll 复制到 [盘符:]/InstallShield Express Projects/[安装项目名称]/Media/cdrom/Disk Images/Disk1/MSDE 中。
注意:这个检测脚本好象不能用在WebProject中 如果可以,大家谁告诉我怎么办 谢谢