装载HYDRA插件

procedure THostForm.LoadLocalModules;
var
  i, x : integer;
  parentnode: TTreeNode;
  controller : THYModuleController;
  plugindescriptor : THYPLuginDescriptor;
begin
  TreeView.Items.BeginUpdate;
  with ModuleManager do
  begin
    LoadModules(GetAppPath + 'plugin/*.dll');
    for i := 0 to (ModuleCount - 1) do         
    begin
      controller := Modules[i].ModuleController;
      if blTree(controller.Descriptor.Name) <> nil then
        parentnode := blTree(controller.Descriptor.Name)
      else
        parentnode := TreeView.Items.AddChildObject(NIL,
          controller.Descriptor.Name, controller);
      for x := 0 to (controller.PluginDescriptorCount - 1) do
      begin
        plugindescriptor := controller.PluginDescriptors[x];
        TreeView.Items.AddChildObject(parentnode,
          plugindescriptor.Name, plugindescriptor);
      end;
    end;
  end;
    TreeView.Items.EndUpdate;
end;

posted @ 2010-11-25 16:16  delphi中间件  阅读(291)  评论(0编辑  收藏  举报