我做的一个小程序使用了acrobat的pdf控件,因此用户的计算机上必须安装acrobat才能正常使用,我想在运行小程序前先检测用户的机器上是否安装了acrobat,如果安装了则直接运行,如果没有则提示要先安装,不知道怎么能够实现呢

解决方案 »

  1.   


    查看注册表中是否有安装程序的路径
    procedure TForm6.Button1Click(Sender: TObject);
    var
    Rego:TRegistry;
    begin
      Rego:=TRegistry.Create;
      with Rego do
      begin
         try
           try
             Rego.
             RootKey:=HKEY_LOCAL_MACHINE;  
          openKey'SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\Acrobat.exe’,True);
             RarPath:=ReadString('path');
             if  trim(RarPath)='' then
             begin
                messagedlg(' 你机器上没有安装Acrobat',mtInformation,[mbOK],0);
                exit;
             end;
           except          messagedlg('读取注册表失败 ',mtInformation,[mbOK],0);
                exit;
           end;
        finally
          Rego.Free;
        end;
      end;
    end;