AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Hydra 3.0 Plugin

Ein Thema von hanspeter · begonnen am 3. Sep 2007 · letzter Beitrag vom 17. Sep 2007
 
hanspeter

Registriert seit: 26. Jul 2003
Ort: Leipzig
1.350 Beiträge
 
Delphi XE2 Professional
 
#10

Re: Hydra 3.0 Plugin

  Alt 17. Sep 2007, 15:05
Ich habe es mal schnell in ein bestehendes Projekt eingebunden und habe kein Problem.

1. Das Interface

Delphi-Quellcode:
  
type

  IListBoxInterface = interface
      ['{2993CFD4-EC29-42C2-BB49-707C9A254B4F}']
   procedure SetEditField(Parent: TWinControl;Edit: TEdit);
   function GetVersion: String;
  end;

implementation

end.
2. Das Plugin

Delphi-Quellcode:
type
  TMyListBoxPlugin = class(THYVisualPlugin, IListBoxInterface)
    Edit1: TEdit;
    ListBox1: TListBox;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
  protected
  public
    procedure SetEditField(Parent: TWinControl;Edit: TEdit);
    function Getversion: string;
  end;
Die Funktion selber:

Delphi-Quellcode:
function TMyListBoxPlugin.Getversion: string;
begin
  result := '1.0';
end;

Und der Aufruf im Host

Delphi-Quellcode:
 

var
  FListIfForm : IListBoxInterface;

with ModuleManager do begin
    // Loads the module
    LoadModule('VisualModule.dll');
    CreateVisualPlugin('MyListBoxPlugin', fListForm);
    FListIfForm := fListForm as IListBoxInterface;
    fListForm.ShowParented(Panel1);
Der Aufruf : Edit2.Text := FListIfForm.GetVersion;


Das entsorgen:

Delphi-Quellcode:
 
  FListIfForm := nil; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  ModuleManager.ReleaseInstance(fListForm);
  // Unloads the module
  ModuleManager.UnloadModules;
Der Fehler kommt, weil das Interface (eigene Referenzzählung) getrennt entsorgt werden muss.
Also den Referenzzeiger auf nil setzen und dann erst den Rest entsorgen.

Gruß Peter
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:28 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz