Nico Z
Nico Z

Reputation: 1027

Install file in Inno Setup Pascal code using FileCopy function (not to show the installation on wizard form)

How to copy a file using FileCopy function to the application folder, so that it's name does not display on the installing page? (FilenameLabel).

I.e. I want to use the first option of Inno Setup - How to hide certain filenames while installing? (FilenameLabel)

Upvotes: 0

Views: 2265

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202118

Use the CopyFile function in the CurStepChanged event function:

[Files]
Source: "MyProg.exe"; Flags: dontcopy

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
begin
  { Install after installation, as then the application folder exists already }
  if CurStep = ssPostInstall then
  begin
    Log('Installing file');
    ExtractTemporaryFile('MyProg.exe');
    if CopyFile(
         ExpandConstant('{tmp}\MyProg.exe'), ExpandConstant('{app}\MyProg.exe'),
         False) then
    begin
      Log('File installed.');
    end
      else
    begin
      Log('Failed to install file.');
    end;
  end;
end;

Upvotes: 2

Related Questions