Based on the answers by @Slava Ivanov and @MB., a code for Inno Setup is:
const
AppPathsKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths';
const
SCS_32BIT_BINARY = 0;
SCS_64BIT_BINARY = 6;
function GetBinaryType(ApplicationName: string; var BinaryType: Integer): Boolean;
external '[email protected] stdcall';
function GetAppVersionAndBinaryType(
ProgramFileName: string; var Version: string; var BinaryType: Integer): Boolean;
var
ProgramPath: string;
begin
Result :=
RegQueryStringValue(HKLM, AppPathsKey + '\' + ProgramFileName, '', ProgramPath);
if not Result then
begin
Log(Format('Cannot find a path to "%s"', [ProgramFileName]));
end
else
begin
Log(Format('Path to "%s" is "%s"', [ProgramFileName, ProgramPath]));
Result := GetVersionNumbersString(ProgramPath, Version);
if not Result then
begin
Log(Format('Cannot retrieve a version of "%s"', [ProgramFileName]));
end
else
begin
Log(Format('Version of "%s" is "%s"', [ProgramFileName, Version]));
Result := GetBinaryType(ProgramPath, BinaryType);
if not Result then
begin
Log(Format('Cannot retrieve a binary type of "%s"', [ProgramFileName]));
end
else
begin
Log(Format('Binary type of "%s" is "%d"', [ProgramFileName, BinaryType]));
end;
end;
end;
end;
The code is for Unicode version of Inno Setup.
Software\Microsoft\Office\%d.0\Excel
key (I do not have Outlook installed to check). – Volkan