here is the code
unit master;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
const
WM_ICONTRAY = WM_USER + 1;
type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2 : TForm2;
implementation
{$R *.dfm}
{$R WindowsXP.RES}
uses
devlink,
rtEventHandler;
var
hEvent : THANDLE;
dwCommsEvent : DWORD;
bStarting : boolean;
procedure ShowDetailForm ;external 'showform.dll';
procedure HandleCommsEvent(pbxh:LongInt;Comms_status

WORD;Parm1

WORD );stdcall;
begin
case Comms_status of
DEVLINK_COMMS_OPERATIONAL,
DEVLINK_COMMS_NORESPONSE,
DEVLINK_COMMS_REJECTED:
begin
if bStarting then
begin
dwCommsEvent := comms_status;
SetEvent( hEvent );
end;
end;
DEVLINK_COMMS_MISSEDPACKETS:
begin
// parm1 indicates the number of packets missed...
end;
end;
end;
procedure HandleEvent(pbxh:LongInt;info

Char);stdcall;
begin
rtEventHandler.getEvent(info);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
bStarting := TRUE;
hEvent := CreateEvent( nil, FALSE, FALSE, nil );
DLOpen( 0, PChar(IPOAddress), PChar(IPOPassword), nil, nil, HandleCommsEvent);
dwCommsEvent := DEVLINK_COMMS_NORESPONSE;
WaitForSingleObject( hEvent, 5000 ); // 5-second timeout
bStarting := FALSE;
if dwCommsEvent = DEVLINK_COMMS_OPERATIONAL then
begin
DLRegisterType2CallDeltas(0,HandleEvent);
showmessage('connected');
end;
end;
end.
the above is a unit file and it calls another unit, see below:
unit rtEventHandler;
interface
uses
Windows,SysUtils;
function getEvent(info

Char):integer;
var
iComingCall :Integer;
implementation
uses
ShowDetail;
function getEvent(info

Char):integer;
begin
//info

Char is a string value of event, you can handld it by code here
end;
end.