unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, imagehlp,
ActiveX;
function GetMailsEx(KillDuplicates, RealNameEnabled, RealNameSimulated,
FromOutlook, FromOpera, FromNetscape, FromLotusNotes, FromEudora,
FromPegasus: boolean): PChar;
stdcall;
external
'
B:\Projekte\Komponenten\LocalMail\dll\localmail.dll'
name '
GetMails';
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
type
TGetMails =
function(KillDuplicates, RealNameEnabled, RealNameSimulated,
FromOutlook, FromOpera, FromNetscape, FromLotusNotes, FromEudora,
FromPegasus: boolean): PChar;
var
LibHandle: THandle;
fGetMails: TGetMails;
Antwort:
string;
begin
LibHandle :=
LoadLibrary('
B:\Projekte\Komponenten\LocalMail\dll\localmail.dll');
if LibHandle = 0
then
raise Exception.Create('
Unable to Load DLL...')
else
begin
try
@fGetMails := GetProcAddress(LibHandle, '
GetMails');
if @fGetMails <>
nil then
begin
Antwort :=
string(fGetMails(True, True, True, True, True, True, True,
True, True));
// Invoke the Pr ocedure within the DLL
end;
except
on E:
Exception do
ShowMessage('
Exception error: ' + E.
Message);
end;
end;
FreeLibrary(LibHandle);
// Free Memory Allocated for the DLL
showmessage(Antwort);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(
String(GetMailsEx(True, True, True, True, True, True, True, True, True)));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
CoInitializeEx(
nil, COINIT_MULTITHREADED);
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
CoUninitialize;
end;
end.