; 脚本用 Inno Setup 脚本向导生成。
; 查阅文档获取创建 INNO SETUP 脚本文件详细资料!
[Setup]
AppName=科发医院管理系统
AppVerName=科发医院管理系统4.0
AppPublisher=广州科发科技有限公司
AppPublisherURL=http://www.kf200.com
AppSupportURL=http://www.kf200.com
AppUpdatesURL=http://www.kf200.com
DefaultDirName={pf}/科发医院信息管理系统
DefaultGroupName=科发医院管理系统
;LicenseFile=./Soruce/Program/Yygl/最终用户许可协议.txt
Compression=bzip
SolidCompression=no
[Types]
Name: "full"; Description: "完整安装"
Name: "custom"; Description: "自定义安装"; Flags: iscustom
[Components]
Name: "program"; Description: "全部程序"; Types: Custom
;Name: "Program/His"; Description: "医院管理信息系统"; Types: full
;//Custom
;//Name: "program/ClientSet"; Description: "客户端"; Types: full
Name: "program/Kfpt"; Description: "二次开发平台"; Types: Custom
;Name: "program/Czsc"; Description: "操作手册"; Types: Custom
;//full Custom
Name: "program/ServerApp"; Description: "后台服务控制器"; Types: Custom
Name: "readme"; Description: "自述文件"; Types: full
[Tasks]
; 注意: 下面的条目包含一个中文用语 (“创建桌面快捷方式”和“添加快捷方式”)。如果需要你可以翻译为其它语言。
Name: "desktopicon"; Description: "创建桌面快捷方式"; GroupDescription: "添加快捷方式:"; Flags: unchecked
;//unchecked
[Files]
Source: "./Soruce/Program/kfpt/*"; DestDir: "{app}"; components :program/kfpt ;Flags: ignoreversion recursesubdirs
Source: "./Soruce/Program/ServerApp/*"; DestDir: "{app}"; components :program/ServerApp ;Flags: ignoreversion recursesubdirs
Source: "./Soruce/Data/*.*"; DestDir: "{drive:{app}}/Data"
; 注意: 不要在任何共享系统文件中使用“Flags: ignoreversion”
[Icons]
Name: "{group}/后台服务控制器"; Filename: "{app}/ServerApp.exe" ;WorkingDir: "{app}" ;components :program/ServerApp
Name: "{group}/二次开发平台"; Filename: "{app}/KfPt.exe" ;WorkingDir: "{app}" ;components :program/kfpt
; 注意: 下面的条目包含一个中文用语 (“卸载”)。如果需要你可以翻译为其它语言。
Name: "{group}/卸载 科发医院管理系统"; Filename: "{uninstallexe}"
[Run]
; 注意: 下列条目包含一个中文用语 (“运行”)。如果需要你可以翻译为其它语言。
[Code]
{--- SQLDMO ---}
const
SQLServerName = '(local)';
SQLDMOGrowth_MB = 0;
procedure InstallDb();
var
SQLServer, Database, DBFile, LogFile: Variant;
IDColumn, NameColumn, Table: Variant;
FlagDbExist:Boolean;
FileName1, Filename2,DbName,DbPath:String;
begin
//;if MsgBox('安装程序现在将通过一个可信任的连接到 Microsoft SQL 服务器 ''' + SQLServerName + ''' 并创建一个数据库。你想继续吗?', mbInformation, mb_YesNo) = idNo then
// Exit;
{ 创建主 SQLDMO COM 自动操作对象 }
try
SQLServer := CreateOleObject('SQLDMO.SQLServer');
except
RaiseException('未安装数据库服务器,先请安装 Microsoft SQL Server 服务器。'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
exit;
end;
{ 连接到 Microsoft SQL 服务器 }
DbName:='KfHis_std_a';
//私营版
SQLServer.LoginSecure := True;
SQLServer.Connect(SQLServerName);
//MsgBox('已连接到 Microsoft SQL 服务器 ''' + SQLServerName + '''.', mbInformation, mb_Ok);
{ 安装数据库 }
FlagDbExist:=True;
Database := CreateOleObject('SQLDMO.Database');
try
Database := SQLServer.Databases.Item(DbName);
except
FlagDbExist:=False;
end;
if FlagDbExist=False then
else
exit; {数据库已安装}
FileName1:= ExpandConstant('{drive:{app}}/Data')+'/KFHIS.mdf';
Filename2:= ExpandConstant('{drive:{app}}/Data')+'/KFHIS_log.ldf';
{附加数据库}
dbPath:= FileName1+' , '+Filename2;
try
SQLServer.AttachDB(DBName, dbPath);
except
MsgBox('数据库安装失败!', mbInformation, mb_Ok);
exit;
end;
MsgBox('数据库安装成功!', mbInformation, mb_Ok);
end;
function InitializeSetup(): Boolean;
begin
{ MsgBox('aa', mbInformation, mb_Ok); }
Result:=True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
{ if CurPageID=wpInfoAfter then
begin
MsgBox('pageid'+inttostr(CurPageID),mbInformation, mb_Ok);
InstallDb();
end; }
Result:=True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then
begin
InstallDb();
CreateDir(ExpandConstant('{app}/Datalink'));
FileCopy(ExpandConstant('{app}/DefLink.udl'),ExpandConstant('{app}/Datalink/DefLink.udl'),True);
end;
end;