unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, imagehlp,
ActiveX;
function GetMailsEx(Mails: PChar; KillDuplicates, RealNameEnabled,
RealNameSimulated, FromOutlook, FromOpera, FromNetscape, FromLotusNotes,
FromEudora, FromPegasus: boolean): boolean;
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;
const
MAX_RESULT = 4000;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
type
TGetMails =
function(Mails: PChar; KillDuplicates, RealNameEnabled,
RealNameSimulated, FromOutlook, FromOpera, FromNetscape, FromLotusNotes,
FromEudora, FromPegasus: boolean): boolean;
stdcall;
var
LibHandle: THandle;
fGetMails: TGetMails;
Antwort: PChar;
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 := StrAlloc(MAX_RESULT);
if fGetMails(Antwort, True, True, True, True, True, True, True, True,
True) = True
then
showmessage(Antwort);
end;
except
on E:
Exception do
ShowMessage('
Exception error: ' + E.
Message);
end;
end;
FreeLibrary(LibHandle);
// Free Memory Allocated for the DLL
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Antwort: PChar;
begin
Antwort := StrAlloc(MAX_RESULT);
if GetMailsEx(Antwort, True, True, True, True, True, True, True, True, True)
= True
then
ShowMessage(Antwort);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
CoInitializeEx(
nil, COINIT_MULTITHREADED);
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
CoUninitialize;
end;
end.