In Delphi for Win32 OOP, an event of an object might be handled by one method (event handler). Here's how to get the list of those events of an object, that have a handler attached...
Use the next code for the OnCreate handler of a Form1 object (TForm). Place two ListBox'es on the form, and run ...
ListBox1 holds the names of all events of the Form1 object, ListBox2 only those having a handler attached.
USES TYPINFO, .... !!!!
procedure TForm1.FormCreate(Sender: TObject) ;
Count, Loop: Integer;
method : TMethod;
Count := GetPropList(TypeInfo(TForm1), tkMethods, nil) ;
GetMem(List, Count * SizeOf(PPropInfo)) ;
GetPropList(TypeInfo(TForm1), tkMethods, List) ;
for Loop := 0 to Pred(Count) do
method := GetMethodProp(Form1, List[Loop]^.Name) ;
if Assigned(method.Code) and Assigned(method.Data) then
FreeMem(List, Count * SizeOf(PPropInfo))
Note: once you know the name of the event with the handler attached, here's how to execute a method by its name