我想要完成如下的功能:
写一全个过程
doprocedure(procedurename:string)
该过程能执行procedurename所指的过程。
不知该如何去写。
写一全个过程
doprocedure(procedurename:string)
该过程能执行procedurename所指的过程。
不知该如何去写。
解决方案 »
- delphi dbgrideh 导出EXCEL 问题
- 我在窗体上放了image,撑满整个窗体,图片不大,只有50K,可是打开窗体的时候,总是先显示灰色的窗体,然后再显示image,有滞后的感觉
- hlp文件做好了。怎么通过窗体中的按扭打开它。。(刚学delphi)
- 请问各位,如何在连续的n个自然数中随机抽取3个不同的数?
- 怎么限制一个文本框只能输入日期?
- 3000分求多媒体教室源码
- 急!!求助:关于MS SQL Server 数据库转到 Access 数据库的问题.
- TWebBrowser如何获取其文件内容?
- 关于调用COM+对象传递参数的问题
- 用什么方法在TtreeView中实现数据库的树状表示???
- win2000server,怎么得到当前用户的登录密码?
- ADODataSet.DeleteRecords(arAll)提示:"在此环境中不允许操作",以及:BOF 或 EOF 中有一个是“真”,或者当前记录已经被删除,所需的操作
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;type
Taa = procedure;var
Form1: TForm1;
s : string;procedure aa;
procedure bb(proc : Taa);implementation{$R *.DFM}procedure aa;
begin
s := 'aa';
end;
procedure bb(proc : Taa);
begin
proc;
showMessage(s);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
bb(aa);
end;end.
if str='aa' then aa
else str='procedur name' then dosomethinga boring way :P
若不是,....好像只好建立映射表了!
什么程序非得这么做啊,用过程型变量不是挺好吗?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
published
procedure Test(const str: string);
{ Public declarations }
end;
TCustomProc = procedure(const P: string) of object;
var
Form1: TForm1;
implementation{$R *.DFM}procedure TForm1.Test(const str: string);
begin
ShowMessage(str);
end;procedure TForm1.Button1Click(Sender: TObject);
var
proc: TCustomProc;
begin
@proc := MethodAddress('Test');
if assigned(proc) then
proc('fjgkldfjgjdfj');
end;end.