J
jeffrey_s
Unregistered / Unconfirmed
GUEST, unregistred user!
前一个帖子是: http://www.delphibbs.com/delphibbs/dispq.asp?lid=3815761
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
MyProc = procedure
//定义函数指针
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
var
Index: Integer;
Proc1: array[0..1] of MyProc;
implementation
{$R *.dfm}
procedure CallProc;
begin
// 这里如何写 才能得出所调用的指针 也就是 @@Proc1[0] 或 @@Proc1[1]
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Index := 0;
Proc1[Index];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Index := 1;
Proc1[Index];
end;
initialization
Proc1[0] := CallProc;
Proc1[1] := CallProc;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
MyProc = procedure
//定义函数指针
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
var
Index: Integer;
Proc1: array[0..1] of MyProc;
implementation
{$R *.dfm}
procedure CallProc;
begin
// 这里如何写 才能得出所调用的指针 也就是 @@Proc1[0] 或 @@Proc1[1]
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Index := 0;
Proc1[Index];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Index := 1;
Proc1[Index];
end;
initialization
Proc1[0] := CallProc;
Proc1[1] := CallProc;
end.