How to get the address of a variable containing an event handler?
eg.
TExample = class(TObject)
private
FOnChange: TNotifyEvent;
end;
I need a private member addressFOnChange , an event handler, a variable.
Why?
I am trying to figure out who overwrites my handler variable FOnChangewith garbage.
I go through the code:
if Assigned(FOnChange) then
FOnChange(Self);
No event handler is assigned, and for a time is a variable FOnChange nilin the viewport:
@FOnChange: nil
Addr(FOnChange): nil
But later the variable FOnChangeturns into garbage:
@FOnChange: $2C
Addr(FOnChange): $2C
So, I want to look at a variable FOnChangein the data area of โโthe CPU window so that I can look at it with:
00410018 00000000
to
00410018 0000002C
Also, I do not know the address FOnChange; I just made up $410018.
?
,
OnChange: nil
@OnChange: nil
@@OnChange: Variable required
@FOnChange: nil
Assigned(OnChange): False
Assigned(FOnChange): False
@@FOnChange: $253B588
addr(addr(FOnChange)): $253B588
Alt + F5
- OnChange:
OnChange: TNotifyEvent $253B588 - FOnChange: "FOnChange":
- Self.FOnChange: "Self.FOnChange": .
- @OnChange:
@OnChange: Pointer $253B588 - @@OnChange: "@@OnChange":
- @FOnChange:
@FOnChange: Pointer $253B588 - @@FOnChange:
@@FOnChange: ^Untyped (no address) : @@FOnChange $253B588`
, -, 0x253B588.
, :
MyControl1.OnChange := TheOnChangeHandler;
:
mov edx,[ebp+$08] ;move stack variable $08 into edx
mov [eax+$00000208],edx ;and then into offset $208 of my control
mov edx,[ebp+$0c] ;move stack variable $0c into edx
mov [eax+$0000020c],edx ;and then into offset $20c of my control
, FOnChange, !