 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Nov 29, 2006 2:17 am Post subject: [D6Ent] How to get object address of method pointer |
|
|
Hi all,
I have problem with geting the address of object.
I want to do something like this:
function ExtractSubject(rn: TMyNotification): TComponent;
begin
if @rn = Nil then
Result:=Nil
else
Result:=TComponent(@rn); // hire is the problem
end;
I need the reference to the object(class) the method belongs to, not
the address of the procedure itself.
TMyNotification is:
TMyNotification = procedure (Sender: TObject; rr: TMyReason) of
object;
Thanks for any answer.
G.M. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 29, 2006 4:35 am Post subject: Re: [D6Ent] How to get object address of method pointer |
|
|
Hire is the solution:
function ExtractSubject(rn: TMyNotification): TComponent;
var
Address: Pointer;
x: array[0..1] of Integer;
begin
if @rn = Nil then
Result:=Nil
else
begin
Address:=@@rn;
CopyMemory(@x, Address, SizeOf(Integer)*2);
Result:=TComponent(x[1]);
end;
end;
Bye, bye.
G.M. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|