Einzelnen Beitrag anzeigen

moelski

Registriert seit: 31. Jul 2004
1.110 Beiträge
 
Delphi 2010 Professional
 
#2

AW: Benutzen von Klassen aus einer DLL

  Alt 14. Sep 2010, 05:39
Moin nochmal,

ich habe die Klasse nochmal erweitert um ein Formular und ein NrComm (serielle Komponente).
Delphi-Quellcode:
unit Obj_Unit;

interface

Uses nrclasses, nrcomm, Forms, Unit2;

type
  TMWSt = class
  protected
    nrcomm : TnrComm;
    Form : TTestForm;
  public
    function GetBrutto (const aNetto : Currency): Currency; virtual; abstract;
    procedure SetPercent(const aPercent : Integer ); virtual; abstract;
    Function ShowPortInfo : string; virtual; abstract;
  published
    property Comm : TnrComm read nrcomm write nrcomm;
    property Formular : TTestForm read Form write Form;
  end;

const
  MWST_VERSION = 1;

implementation

end.
Dann habe ich in der anwendung zwei Instanzen erstellt:
Delphi-Quellcode:
  Obj1 := CreateMWStObj;
  Obj1.Comm := nrComm1;
  Obj1.Formular := TTestForm.Create(Self);
  Obj1.Formular.Show;

  Obj2 := CreateMWStObj;
  Obj2.Comm := nrComm2;
Und natürlich in der DLL die Funktion ergänzt.

Auch das funktioniert. Habe mir auf das Formular 2 Buttons gesetzt um jeweils ShowPortInfo der Instanz aufzurufen. Klappt bis jetzt tadellos.

Aber ich bin mir irgendwie fast sicher das diese Technik einen Haken hat
Dominik Schmidt
Greetz Dominik

I love Delphi 2007/2010
  Mit Zitat antworten Zitat