在我的设置中,我需要检查是否已安装程序,如果没有安装,我需要在安装应用程序之前先安装它。 我不知道如何在[文件]部分之前提取所需的文件 这是我的代码:
[Files]
Source: "..\PREREQUIREMENTS\DicomObjects\DicomObjectsSetup43.exe"; DestDir: "{src}\PreReq\DO\Setup\"; DestName: "DOSETUP.exe"; Flags: ignoreversion
Source: "..\PREREQUIREMENTS\DicomObjects\License\DicomObjects.lic"; DestDir: "{src}\PreReq\DO\Lic\"; Flags: ignoreversion
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
if not FileExists(ExpandConstant('"{pf}\Medical Connections\DicomObjects\DicomObjects.ocx"'))then if MsgBox ('installazione DO', mbInformation, mb_YesNo) = idYes then
begin
Exec(ExpandConstant('{src}\PreReq\DO\Setup\DOSETUP.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
Exec('cmd.exe','/c COPY "{src}\PreReq\DO\Lic\*.*" "{pf}\Medical Connections\DicomObjects\"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;
我也尝试了此代码,但没有用
function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
if not FileExists(ExpandConstant('"{pf}\Medical Connections\DicomObjects\DicomObjects.ocx"'))then
begin
ExtractTemporaryFile('DOSETUP.exe');
Exec(ExpandConstant('{src}\PreReq\DO\Setup\DOSETUP.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
Exec('cmd.exe','/c COPY "{src}\PreReq\DO\Lic\*.*" "{pf}\Medical Connections\DicomObjects\"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;