Here's a Simple Trick to Execute A Delphi Object's method by name:
~~~~~~~~~~~~~~~~~~~~~~~~~ Type Tform1 = Class (TFORM) pad button 1: tbutton; pad pad procedure button1click Jian procedure CallMeByName (Sender: TObject); private Jian Jian Jian procedure ExecMethod (OnObject: TObject; MethodName: string); letterhead end; var memo Form1: TForm1; type memo TExec = procedure of object; procedure TForm1.ExecMethod (OnObject: TObject ; MethodName: string); var Annotation Routine: TMethod; Annotation Exec: TExec; begin memo Routine.Data: = Pointer (OnObject); memo Routine.Code: = OnObject.MethodAddress (MethodName); memo if NOT Assigned (Routine.Code ) then Exit; memo Exec: = TExec (Routine); letterhead Exec; end; procedure TForm1.CallMeByName (Sender: TObject); begin memo ShowMessage ( 'Hello Delphi!'); end; procedure TForm1.Button1Click (Sender: TObject) ; Begin Execmethod (Form1, 'CallmeByName); END;