How to get Inno Setup to check for a file

When I compile the Inno Setup script below, it gives me an error (below). I borrowed the code here , so I'm not sure why it is not working properly.

Line 136:
Column 10:
Invalid prototype for 'FileDoesNotExist'

Line 136 is function FileDoesNotExist(file: string): Boolean;

[Run]
Filename: "{sys}\regsvr32.exe"; Parameters: "msstdfmt.dll"; WorkingDir: {app}\Pronto\Programs\; BeforeInstall: FileDoesNotExist(ExpandConstant('{sys}\msstdfmt.dll')); StatusMsg: "Registering Controls..."

[Code]
function FileDoesNotExist(file: string): Boolean;
begin
  if (FileExists(file)) then
    begin
      Result := False;
    end
  else
    begin
      Result := True;
    end;
end;
+5
source share
1 answer

From the Inno installation documentation :

All BeforeInstall and AfterInstall functions must not have a return value .

In other words, it cannot be function, because it cannot return anything; it is a procedure. (In the examples on the linked page, you can see that they are all declared as procedure, and none of them contain Resultin the code.)

( , BTW. procedure, Boolean, , , . , , Pascal - procedure .)

, , . msstdfmt.dll setup, [Files] onlyifdoesntexist regserver. , .

[Files]
Source: "msstdfmt.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist regserver 
+3

All Articles