library DelphiDll;
{ Important note about DLL memory management: ShareMem must be the
...}
uses
ShareMem,
clBatch,
...;
{$R *.res}
exports
ShowTestForm;
begin
end.
unit uFormTest;
interface
uses
...
type
TFormTest =
class(TForm)
EditAnalyse: TEdit;
Label1: TLabel;
btnAssFilled: TButton;
btnAssInjected: TButton;
procedure btnAssFilledClick(Sender: TObject);
procedure btnAssInjectedClick(Sender: TObject);
private
{ Private declarations }
FAnalyse: TAnaylse;
procedure SetAnalyse(aAnalyse: TAnalyse);
public
{ Public declarations }
constructor Create(AOwner: TComponent);
class procedure ShowForm(aApplication: TApplication; aAnalyse: TAnalyse);
end;
implementation
{$R *.dfm}
uses
...;
var
dllApplication: TApplication=nil;
FormTest: TFormTest=nil;
procedure TFormTest.btnAssFilledClick(Sender: TObject);
begin
if not Assigned(FAnalyse)
then exit;
FAnalyse.Status := assFilled;
end;
procedure TFormTest.btnAssInjectedClick(Sender: TObject);
begin
if not Assigned(FAnalyse)
then exit;
FAnalyse.Status := assInjected;
end;
constructor TFormTest.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FAnalyse:=
nil;
end;
procedure TFormTest.SetSample(aAnalyse: TAnalyse);
begin
FAnalyse:= aAnalyse;
end;
class procedure TFormTest.ShowForm(aApplication: TApplication; aAnalyse: TAnalyse);
begin
if not Assigned(dllApplication)
then
begin
dllApplication:= Application;
end;
Application := aApplication;
if not Assigned(FormTest)
then
FormTest := TFormTest.Create(Application);
FormTest.FAnalyse := aAnalyse;
if not Assigned(aAnalyse)
then
FormTest.EditAnalyse.Text := '
-'
else
;
// EditAnalyse.Text := aAnalyse.name;
{ TODO :
Mit der auskommentierten Zeile gibt es im folgenden eine Exception "Invalid pointer operation ..."
was irgendetwas mit strings zu tun hat. Richtig angezeigt wird der Name dennoch.
Die Ursache ist zu ergründen.
}
FormTest.Show;
end;
initialization
begin
dllApplication :=
nil;
end;
finalization
begin
if Assigned(dllApplication)
then Application := dllApplication;
end;
end.