unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, JvExStdCtrls, JvListBox, JvDialogs, Defines;
type
TForm1 =
class(TForm)
OpenDialog: TJvOpenDialog;
JvListBox1: TJvListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure DLLAufruf(Command: Integer);
private
Lib: THandle;
PluginGetName: TGetName;
PluginGetVersion: TGetVersion;
PluginSetCallBackProc: TSetCallBackProc;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
if Opendialog.Execute
then begin
Lib := LoadLibrary(PChar(OpenDialog.FileName));
if Lib = 0
then
ShowMessage('
Plugin konnte nicht geladen werden!');
@PluginGetName := GetProcAddress(Lib, '
GetName');
Self.JvListBox1.Items.Add('
Name: ' + PluginGetName);
@PluginGetVersion := GetProcAddress(Lib, '
GetVersion');
Self.JvListBox1.Items.Add('
Version: ' + PluginGetVersion);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if Lib <> 0
then begin
@PluginSetCallBackProc := GetProcAddress(Lib, '
SetCallBackProc');
PluginSetCallBackProc(@DLLAufruf);
// Hier kommt die Meldung Variable benötigt
end;
end;
procedure TForm1.DLLAufruf(Command: Integer);
begin
ShowMessage(Format('
Command von DLL: %d', [Command]));
end;
end.