一个dll中函数有一个参数,LpCallBack说明为类型Long (pointer to a function that should be executed after reading is over),函数名为test(LpCallBack:LongWord):integer; 其中有一个函数function abc():integer; 如何在test()中将该函数的地址传入,vb的例子中用address of 关键字,那delphi呢,怎么做
调试欢乐多
begin
end;procedure 你自己的过程();
var
ii:integer;
begin
ii=test(@abc);
end;
function test(lpCallBack:longword);integer;stdcall;external 'dll函数名称'
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type abc=function():integer;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
function test(lpCallBack:LongWord):integer;
begin
result:=0;
end;function abc():integer;
begin
showmessage('a');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ii:integer;
begin
ii:=test(@abc);
end;end.