Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 870141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:25:17+00:00 2026-05-15T10:25:17+00:00

How do i get the address of the variable holding an event handler? e.g.

  • 0

How do i get the address of the variable holding an event handler?

e.g.

TExample = class(TObject)
private
    FOnChange: TNotifyEvent;
end;

i want the address of the FOnChange private member, event handler, variable.


Why?

i’m trying to figure out who is overwriting my FOnChange handler variable with junk.

i am stepping through code:

if Assigned(FOnChange) then
    FOnChange(Self);

No event handler is ever assigned, and for a while the FOnChange variable is nil in the Watch Window:

@FOnChange: nil
Addr(FOnChange): nil

But later the FOnChange variable is getting turned into junk:

@FOnChange: $2C
Addr(FOnChange): $2C

So i want to watch the FOnChange variable in data pane of the CPU window, so that i can watch it to from:

00410018 00000000

to

00410018 0000002C

Except i don’t know the address of FOnChange; i just made up the $410018.

How can i find the address of an event variable?


Things i’ve tried

Watch List

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: Error inspecting ‘FOnChange’: expression error
  • Self.FOnChange: Error inspecting ‘Self.FOnChange’: expression error
  • @OnChange: @OnChange: Pointer $253B588
  • @@OnChange: Error inspecting ‘@@OnChange’: expression error
  • @FOnChange: @FOnChange: Pointer $253B588
  • @@FOnChange: @@FOnChange: ^Untyped (no address) Data: @@FOnChange $253B588`

The concensus seems to be at address 0x253B588.

Yet when i run some sample code:

MyControl1.OnChange := TheOnChangeHandler;

That turns into:

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

No wonder i can’t find an address of FOnChange, it’s two addresses!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:25:17+00:00Added an answer on May 15, 2026 at 10:25 am

    You can get the address through the Debug Inspector. To get the address of a field, put a breakpoint in your code at some point before the change has happened, for example right after you call the constructor. Then open your object in the Debug Inspector. Not sure how you get it in the old IDE style, but in D2010 you can get this from the Run->Inspect… menu command, from a button in Evaluate/Modify, or by hitting ALT-F5 on the keyboard. (Be careful you don’t hit ALT-F4!)

    The Debug Inspector will show you your object with all its fields. Double-click on one of the fields and it will open in a new Debug Inspector window. In the edit box-like bar at the top will be the address of your field. You can use this to set a memory breakpoint to find where the value changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.