[DUG] Callback events from DLLs

Allan, Samuel S.A.Allan at massey.ac.nz
Mon Jun 27 09:21:05 NZST 2005


I don't know how being in a DLL effects things, but if I understand you
right, you are trying to do something like:

Type
  TREvent = procedure(sUsername : PChar; ievent:integer);

function StartFunction(lpPath : PChar; oTREvent : TREvent): boolean;
begin
  ...
  if oTREvent <> nil then
    oTREvent('username', 12);
  ...
end;

And then put a bunch of DLL stuff around it. But when you call
StartFunction, and pass in a procedure it will cause the procedure to be
run also.

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Jeremy Coulter
Sent: Friday, June 24 2005 4:06 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Callback events from DLLs


Hi All.....I will TRY and clarify what I am trying to do.

I have a DLL that has a callback event in it.
I then created a type :-

Type
  TREvent            =   procedure(sUsername : PChar; ievent:integer) ;
stdcall; 

Then I declare the function I am calling in the DLL (I am using
LoadLibrary)

TRStart     =   Function (lpPath : PChar; oTREvent : TREvent) : boolean;
stdcall;

Now what I am not sure how to do is, have a procedure fire when the
event is
triggered.
Is this possible? Or do I have to pool the event object? 
The event will trigger at any time.

Hope this clears up what I am trying to do.

Jeremy


-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On
Behalf Of Jeremy Coulter
Sent: 24 June 2005 15:32
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Callback events from DLLs

Actually....I have remembered a bit.
I am just trying to remember  how to assign the event to a procedure.

jeremy 

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On
Behalf Of Jeremy Coulter
Sent: 24 June 2005 15:02
To: delphi at delphi.org.nz
Subject: [DUG] Callback events from DLLs


Hi All.
Some time ago I did some stuff with Callback events from a DLL.

I have to do it again (different DLL) and I cant find the code, and my
memory is not that good :-)

How would I handle the following in Delphi?

 BOOL RStart(char* lpPath, onREvent event) 

This function has just been altered and I used to declare it

Function RStart(lPath:PChar) : boolean; stdCall; external  the.dll

How would I handle it now that it uses an event?

Jeremy


_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi



_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi




_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi



More information about the Delphi mailing list