1

我有这段代码提示用户安装 Foxit PDF 阅读器。如何查看电脑是否安装了 Adob​​e Acrobat Reader?

[Components]
Name: "foxit"; Description: "Foxit"; Types: "games"; ExtraDiskSpaceRequired: "30000000"; Check: "not AcrobatExists"; 

如果没有找到 Adob​​e Acrobat Reader,那么我想开始安装 Foxit Reader。

4

1 回答 1

2

试试这个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;
于 2013-04-14T13:25:42.073 回答