Как проверить, установлен ли Adobe Acrobat Reader
У меня есть этот код, который предлагает пользователю установить Foxit PDF Reader. Как я могу проверить, установлен ли на компьютере Adobe Acrobat Reader или нет?
[Components]
Name: "foxit"; Description: "Foxit"; Types: "games"; ExtraDiskSpaceRequired: "30000000"; Check: "not AcrobatExists";
Если Adobe Acrobat Reader не найден, я хочу начать установку Foxit Reader.
1 ответ
Попробуйте Acrobat Reader - определить установленную версию скрипта:
[Setup]
AppName=Acrobat
AppVerName=Acrobat
DefaultDirName={pf}\Acrobat
DisableStartupPrompt=true
Uninstallable=false
DisableDirPage=true
OutputBaseFilename=Acrobat
CreateAppDir=false
[Code]
function GetAcrobatReaderVersion(): String;
var
sVersion: String;
begin
sVersion := '';
RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe',
'', sVersion );
GetVersionNumbersString( sVersion , sVersion );
Result := sVersion;
end;
function NextButtonClick(CurPage: Integer): Boolean;
begin
// by default go to next page
Result := true;
if CurPage = wpWelcome then
begin
if Length( GetAcrobatReaderVersion() ) = 0 then
begin
MsgBox( 'There is not installed Acrobat reader', mbInformation, MB_OK );
Result := false;
end
else
MsgBox( 'Acrobat reader installed is version ' + GetAcrobatReaderVersion() ,
mbInformation, MB_OK );
end;
end;
Вы можете взять GetAcrobatReaderVersion() и сделать функцию проверки, например:
function AcrobatExists(): Boolean;
begin
result := Length( GetAcrobatReaderVersion() ) <> 0;
end;