Inno Setup: Disabling components based on PC architecture
I'm using Inno Setup with two components: one for 32-bit machines and one for 64-bit. These will run on XP/Vista/Win7.
[Components]
Name: Bin/32; Description: 32-bit; Types: full; Flags: dontinheritcheck
Name: Bin/64; Description: 64-bit; Types: full; Flags: dontinheritcheck
Currently:
- Both Components are ticked by default when running the开发者_如何学C installer.
What I want is:
- An appropriate default (i.e. either 32-bit or 64-bit ticked) depending on the user's machine.
- Greying out the inappropriate Component would be a bonus too.
What I've found so far is:
- That I probably want to use Pascal in the [Code] section.
- The IsWin64 function
- That I might want to use an Event for this, but I can't find anything related to my needs yet.
P.S. Unfortunately I'm not able to have separate installers per architecture.
you can check the C:\Program Files\Inno Setup 5\Examples
folder for examples about how install a program for different architectures using a single installer.
check these files
- 64BitThreeArch.iss
- 64BitTwoArch.iss
- 64Bit.iss
you can use something like this
[Components]
Name: Bin_32; Description: 32-bit; Types: full; Check: IsX86; Flags: dontinheritcheck
Name: Bin_64; Description: 64-bit; Types: full; Check: IsX64; Flags: dontinheritcheck
[Code]
function IsX64: Boolean;
begin
Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
end;
function IsX86: Boolean;
begin
Result := (Is64BitInstallMode=false) and (ProcessorArchitecture = paX86);
end;
精彩评论