Archive for February 2015

Free Disk Space Inno

To show a label on the Inno wizard page displaying the amount of require disk space. Add the following code section to the installer script.

[Code]
procedure InitializeWizard;
begin
WizardForm.DiskSpaceLabel.Visible := True; // False to hide
end;

Download installer script FreeDiskSpace.iss

Check DotNet Framework is installed during Inno Setup

To check that DotNet framework is installed during an Inno install. Add the following code section to the install script.

; Check if dot net is insalled
[code]
function FrameworkIsNotInstalled: Boolean;
begin
Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
end;

// Install dot net with feedback
[Code]
procedure InstallFramework;
var
StatusText: string;
ResultCode: Integer;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// you can interact with the user that the installation failed
MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;

In the files section add the dotnet installer file. Note the flags AfterInstall and Check that will call the functions to check if DotNet is installed and instal if required.

Source: "C:\Example\dotNetFx40_Full_x86_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework; Check: FrameworkIsNotInstalled

Download the installer script CheckDotNet.iss

Mamadou Claquette hackeur ou fdp

vrm la wey c pa bien

CLIQUE CONCOMBRE DES MERS

Check if a program exists before installing with Inno

To check if a program exists before installing with Inno add the following code section to the installer script. In this example we will be testing for the file “c:\Example\Test.exe”. If the test.exe file exist a message box showing “Program Already Exists” will be displayed and the installer will terminate.

[Code]
function IsMyProgramInstalled: boolean;
begin
result := FileExists('C:\Example\Test.exe');
end;

function InitializeSetup: boolean;
begin
result := not IsMyProgramInstalled;
if not result then
MsgBox('Program Already Exists', mbError, MB_OK);
end;

Download the installer script IsMyProgramInstalled.iss

Create empty folders using Inno

When installing a program using Inno, to create an empty directory you will need to add a dirs section to the installer script.

[Dirs]
Name: "{app}\Example1"

Download installer script CreateEmptyDirectories.iss

Automatically Get Target Exe Version in Inno

This example shows how to automattically update the version numbers for you Inno installer based on the version number of the target exe program.

In this example the installer will be installing a program called notepad.exe.

At the top of the script. The version number from the target exe is stored in the variable MyAppVersion

#define MyAppVersion GetFileVersion("notepad.exe")

In the Setup section the MyAppVersion is used to set the installer version number, product version number and used as part of the installer name.

AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
OutputBaseFilename=Setup{#MyAppName}{#MyAppVersion}
VersionInfoVersion={#MyAppVersion}

Download the full installer code AutoGetVersionNumber.iss

Custom Inno Theme

To customise the look of your inno installer, you can modify the images displayed on the install pages. The large image on the left hand side of the instal pages is set using the parameter WizardImageFile. The small image shown on the top right of the install pages is set using the parameter WizardSmallImageFile.

In this example I have replaced the standard images with a large red image. Hopefully you will make an image that is more appealing.

InstallLargeImage

InstallSmallImage

The WizardImageFile and WizardSmallImageFile parameters should be defined in the [setup] section of the inno install script. In this example the images are in the folder c:\InstallFiles and are called Small.bmp and Large.bmp.


[Setup]
WizardSmallImageFile="C:\InstallFiles\Small.bmp"
WizardImageFile="c:\InstallFiles\Large.bmp"

The files must be saved as 256bit bmp files. I created my examples files using GIMP. To save the images using GIMP.

  1. Click File > Export As…
  2. Select a location for the file, enter a file name and then click export
  3. Expand the ‘Compatibility Options’ and check ‘Do not write color space information’. Expand the ‘Advanced Options’ and select 24 bits R8 G8 B8 and then click the export button
  4. Export

    The small image should be 55×58 pixels. The large image should be 164×314 pixels.

    Download full Inno script CustomImage.iss
    Download images Large.bmp Small.bmp