DruckenMister WongFacebook

Werte aus Formular-DLL zurückgeben

System Win9x, WinNT, Win2000, WinXP, Vista, Win7
Ab Delphi-Version Delphi 1
Letzte Änderung 28.09.2010

Formular-DLL erstellen und Folgendes ergänzen/ersetzen:


type
  PTRec = ^TREc;
  TRec = record
    id  : String[10];
    pwd : String[10];
  end;

{$R *.RES}

procedure DLLFormular(ff:PTRec);
var
  DLLForm1: TDLLForm1;
begin
  DLLForm1:=TDLLForm1.Create(Application);
  try
    DLLForm1.ShowModal;
    ff.id  := DLLForm1.Edit1.Text;
    ff.pwd := DLLForm1.Edit2.Text;
  finally
    DLLForm1.Release;
  end;
end;

exports DLLFormular;
 

Host-Anwendung:


procedure DLLFormular(ff:PTRec); stdcall; external '<dllname>.dll';


procedure TForm1.Button1Click(Sender: TObject);
var
  ff : TRec;
begin
  DLLFormular(@ff);
  ShowMessage(ff.id + #13 + ff.pwd); //werte der 2 Edit-felder ausgeben
end;