为什么JclIDEUtils仅在安装Jcl时才有效?

时间:2013-05-27 15:30:30

标签: delphi jedi-code-library

我有以下代码尝试使用JclIDEUtils检测Delphi安装。为了测试它,我设置了两个虚拟机,两个都运行Win 7,在两个系统中我安装了Delphi XE3,但在VM n1中我也安装了Jcl,在VM n2中我没有。 那么,在n1我的小编程工作正常并找到Delphi XE3,在n2它没有! 我尝试在两个VM中远程调试程序,但我唯一理解的是,如果没有安装Jcl,则实例化TJclBorRADToolInstallations类的对象将保持为空。

这是我在我的表单的OnShow事件中的代码:

procedure TForm1.FormShow(Sender: TObject);
var
  I, X: Integer;
  TN, SubTn: TTreeNode;
  IconIndex: Integer;
begin
  FDelphiInstallations := TJclBorRADToolInstallations.Create;
  for I := 0 to FDelphiInstallations.Count - 1 do
  begin
    IconIndex := ilDelphiIcons.AddIcon(GetSmallIcon(FDelphiInstallations[I].IdeExeFileName));
   TN := tvDisplay.Items.AddChild(nil, FDelphiInstallations[I].Name);
   TN.ImageIndex := ilDelphiIcons.Count - 1;
   TN.SelectedIndex := ilDelphiIcons.Count - 1;
   with tvDisplay.Items do
   begin
    SubTn := AddChild(TN, 'Description: ' + FDelphiInstallations[I].Description);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Root directory: ' + FDelphiInstallations[I].RootDir);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Projects directory: '+ FDelphiInstallations[i].DefaultProjectsDir);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Common Projects directory: '+ FDelphiInstallations[i].CommonProjectsDir);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Executable File name: '+ FDelphiInstallations[i].IdeExeFileName);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Build number: '+ FDelphiInstallations[i].IdeExeBuildNumber);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'VersionNumberStr='+ FDelphiInstallations[i].VersionNumberStr);
    SubTn.ImageIndex := 0;
    SubTn := AddChild(TN, 'Registry key='+ FDelphiInstallations[i].ConfigDataLocation);
    SubTn.ImageIndex := 0;
    for X := 0 to FDelphiInstallations[i].IdePackages.Count - 1 do
    begin
      SubTn := AddChild(TN, 'Description: ' + FDelphiInstallations[I].IdePackages.PackageFileNames[X]);
      SubTn.ImageIndex := 0;
    end;
  end;
end;
end;

有人对这个问题有所了解吗?

提前感谢任何建议。

1 个答案:

答案 0 :(得分:1)

Jcl未能检测到Delphi安装,因为我没有运行Delphi。运行Delphi后,JclIDEUtils检测到它的安装,我的测试程序成功显示Delphi安装数据。