您的位置:首页 > 其它

Inno Setup 打包工具 调用MSI格式

2010-11-17 10:21 393 查看
[Code]
procedure InstallDb;
var
Path:string;
Path1:string;
Path2:string;
Path3:string;
Path4:string;
ResultCode: Integer;
RegPath:string;
CrystalReportsPath:string;
CrystalReportsChsPath:string;
ReportViewerPath:string;
ReportViewerLPPath:string;

DownUrl:string;
CrystalReportsFile:string;
CrystalReportsFileChs:string;
ReportViewerFile:string;
ReportViewerFileLP:string;
PackFile:string;
begin
RegPath:='SOFTWARE/Microsoft/.NETFramework/policy/v2.0';
CrystalReportsPath:='SOFTWARE/Classes/Installer/Products/8C4D878457793734882EBDA4FB3D2AD4/SourceList/Net';
CrystalReportsChsPath:='SOFTWARE/Classes/Installer/Products/8C4D878457793734882EBDA4FB3D2AD4';
ReportViewerPath:='SOFTWARE/Classes/Installer/Products/8C4D878457793734882EBDA4FB3D2AD4/SourceList/Media';
ReportViewerLPPath:='SOFTWARE/Classes/Installer/Products/8C4D878457793734882EBDA4FB3D2AD4/SourceList';

PackFile:='{app}/dotnetfx2.exe';
CrystalReportsFile:='{app}/CRRedist2005_x86.msi';
CrystalReportsFileChs:='{app}/CRRedist2005_x86_chs.msi';
ReportViewerFile:='{app}/ReportViewer.exe';
ReportViewerFileLP:='{app}/ReportViewerLP.exe';

//.Net Framework2.0
if RegKeyExists(HKLM, RegPath) then
begin
//MsgBox('系统己安装2.0!',mbInformation,MB_OK);
end
else
//begin if
// MsgBox('系统检测到您没有安装.Net Framework2.0运行环境,是否立即安装?',
// mbConfirmation, MB_YESNO) = idYes then
begin
Path := ExpandConstant(PackFile);
if(FileOrDirExists(Path)) then //检测文件是否存在
Exec(Path, '/q', '',
SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
//end
end

//CrystalReportsPath
if RegKeyExists(HKLM, CrystalReportsPath) then
begin
//MsgBox('系统己安装CrystalReportsPath!',mbInformation,MB_OK);
end
else
//begin if
// MsgBox('系统检测到您没有安装.CrystalReportsPath运行环境,是否立即安装?',
// mbConfirmation, MB_YESNO) = idYes then
begin
Path := ExpandConstant(CrystalReportsFile);
if(FileOrDirExists(Path)) then //检测文件是否存在
ShellExec('', Path, '', '', SW_SHOW, ewNoWait, ResultCode)
//end
end

//.CrystalReportsChsPath
if RegKeyExists(HKLM, CrystalReportsChsPath) then
begin
//MsgBox('系统己安装2.0!',mbInformation,MB_OK);
end
else
//begin if
// MsgBox('系统检测到您没有安装.CrystalReportsChsPath运行环境,是否立即安装?',
// mbConfirmation, MB_YESNO) = idYes then
begin
Path := ExpandConstant(CrystalReportsFileChs);
if(FileOrDirExists(Path)) then //检测文件是否存在
ShellExec('', Path, '', '', SW_SHOW, ewNoWait, ResultCode)
//end
end

//.ReportViewerPath
if RegKeyExists(HKLM, ReportViewerPath) then
begin
//MsgBox('系统己安装2.0!',mbInformation,MB_OK);
end
else
//begin if
// MsgBox('系统检测到您没有安装ReportViewerPath运行环境,是否立即安装?',
// mbConfirmation, MB_YESNO) = idYes then
begin
Path := ExpandConstant(ReportViewerFile);
if(FileOrDirExists(Path)) then //检测文件是否存在
Exec(Path, '/q', '',
SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
//end
end

//.ReportViewerLPPath
if RegKeyExists(HKLM, ReportViewerLPPath) then
begin
//MsgBox('系统己安装2.0!',mbInformation,MB_OK);
end
else
//begin if
// MsgBox('系统检测到您没有安装.ReportViewerLPPath运行环境,是否立即安装?',
// mbConfirmation, MB_YESNO) = idYes then
begin
Path := ExpandConstant(ReportViewerFileLP);
if(FileOrDirExists(Path)) then //检测文件是否存在
Exec(Path, '/q', '',
SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
//end
end
end;

function NextButtonClick(CurPageID:Integer ):Boolean;
var
ResultCode: Integer;
ErrorCode : Integer;
CrystalReportsFile:string;
Path1:string;

begin
if (CurPageID = wpFinished) then begin
InstallDb;
Result := true;
end
else
begin
Result := true;
end
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: