知道一个对象和他的方法名如何动态调用? 说白了就是如何调用一个Object1的methed1, 当然不是简单的Object1.methed1(),用RTTI来类库来实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //这样的?~~type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } published procedure Hello(Sender: TObject); end;var Form1: TForm1;implementation{$R *.dfm}uses TypInfo;procedure TForm1.Button1Click(Sender: TObject);var vMethod: TMethod;begin vMethod.Code := MethodAddress('Hello'); vMethod.Data := Self; TNotifyEvent(vMethod)(Self); TNotifyEvent(vMethod)(Sender);end;procedure TForm1.Hello(Sender: TObject);begin if Assigned(Sender) then ShowMessage(Sender.ClassName) else ShowMessage('nil');end; 关于控制多个控件的简单问题 [北京]诚聘Delphi程序员(3人) 用quickreport3.62做的报表(其中有表格),存为RTF格式后,表格为什么显示不出来? 调查:你使用delphi多长时间? 初学者的问题 如在程序中关闭当前计算机的活动窗口? 简单问题-分多多!!谢谢哪位大哥指点小弟一下 线程未运行完毕,在主窗体退出的时候产生异常,如何屏蔽错误窗口? 关于DLL的问题:Dll能调用窗体吗?.... socket入门问题 如何在窗体上引入excel,并可在excel中进行编辑?(急) d6打印机设置的问题
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
published
procedure Hello(Sender: TObject);
end;var
Form1: TForm1;implementation{$R *.dfm}uses TypInfo;procedure TForm1.Button1Click(Sender: TObject);
var
vMethod: TMethod;
begin
vMethod.Code := MethodAddress('Hello');
vMethod.Data := Self;
TNotifyEvent(vMethod)(Self);
TNotifyEvent(vMethod)(Sender);
end;procedure TForm1.Hello(Sender: TObject);
begin
if Assigned(Sender) then
ShowMessage(Sender.ClassName)
else ShowMessage('nil');
end;