Inno setup INNO-检查文件随msgbox一起安装

Inno setup INNO-检查文件随msgbox一起安装,inno-setup,Inno Setup,要检查目录中是否有1个文件,如果有,请不要重新安装,执行消息并停止程序。用代码靠近它,但当我添加消息时,它会重复4次,仍然会安装!你或任何人能纠正我正在做的事吗?请多谢迈克尔 #define MyAppName "Secretary Assistant" #define MyAppVersion "3.74" #define MyAppPublisher "" [Setup] AppId={{807EB06A-3962-4AF0-967B-D14B0FEF4E9C} AppName={#MyA

要检查目录中是否有1个文件,如果有,请不要重新安装,执行消息并停止程序。用代码靠近它,但当我添加消息时,它会重复4次,仍然会安装!你或任何人能纠正我正在做的事吗?请多谢迈克尔

#define MyAppName "Secretary Assistant"
#define MyAppVersion "3.74"
#define MyAppPublisher ""

[Setup]
AppId={{807EB06A-3962-4AF0-967B-D14B0FEF4E9C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\Users\{username}\Google Drive\Congregation
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=Secretary Assistant 3.74 Setup
Compression=lzma
SolidCompression=yes
UsePreviousAppDir=no
DirExistsWarning=No
DisableWelcomePage=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "D:\GoogleDrive\MapSecAssist\CongData.accdb"; DestDir: "{app}"; Flags:      ignoreversion;  Check: File1(ExpandConstant('{app}\CongData.accdb')); 

[Code]
function File1(FilePath3: String): Boolean;
begin
If FileExists(FilePath3) then 
Result := False
else
Result := True
begin
if FileExists(FilePath3) then
 MsgBox('Congregation Data file is already in your directory ' + FilePath3 + '.    '#13 #13 +
'Setup would OVERWRITE this DATA FILE.'#13 #13+
'Please "Back it up" and then DELETE it from this Directory then start install again !',       mbError, MB_OK);
 end; 
 end; 

在您的位置上,我会在安装之前使用
,而不是
检查

示例如下:

[Files]
Source: "D:\GoogleDrive\MapSecAssist\CongData.accdb"; DestDir: "{app}"; 
 Flags: ignoreversion; BeforeInstall: File1; 

[Code]
var CancelWithoutPrompt: boolean;

function InitializeSetup(): Boolean;
begin
  CancelWithoutPrompt := false;
  result := true;
end;

procedure File1;
begin
    if FileExists(ExpandConstant('{app}\CongData.accdb')) then 
      begin
        MsgBox('Congregation Data file is already in your directory ' +
             ExpandConstant('{app}') + '.    '#13 #13 +
        'Setup would OVERWRITE this DATA FILE.'#13 #13+
        'Please "Back it up" and then DELETE it from this Directory then 
             start install again !', mbError, MB_OK);
        CancelWithoutPrompt := true;
        WizardForm.Close;
      end;
end; 

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
  if CurPageID=wpInstalling then
    Confirm := not CancelWithoutPrompt;
end;

明亮的这正是我想要它做的。非常感谢迈克尔