unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses ObjAuto, Unit2;
{獲取 Unit2.TClass1 的信息}
procedure TForm1.Button1Click(Sender: TObject);
var
MiArr: TMethodInfoArray;
Mi: PMethodInfoHeader;
obj: TClass1;
begin
obj := TClass1.Create;
MiArr := GetMethods(obj.ClassType);
ListBox1.Clear;
for Mi in MiArr do
ListBox1.Items.Add(string(Mi.Name));
obj.Free;
end;
{獲取 Unit2.TClass2 的信息}
procedure TForm1.Button2Click(Sender: TObject);
var
MiArr: TMethodInfoArray;
Mi: PMethodInfoHeader;
obj: TClass2;
begin
obj := TClass2.Create;
MiArr := GetMethods(obj.ClassType);
ListBox1.Clear;
for Mi in MiArr do
ListBox1.Items.Add(string(Mi.Name));
obj.Free;
end;
{獲取 Unit2.TClass3 的信息}
procedure TForm1.Button3Click(Sender: TObject);
var
MiArr: TMethodInfoArray;
Mi: PMethodInfoHeader;
obj: TClass3;
begin
obj := TClass3.Create;
MiArr := GetMethods(obj.ClassType);
ListBox1.Clear;
for Mi in MiArr do
ListBox1.Items.Add(string(Mi.Name));
obj.Free;
end;
end.