一个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呢,怎么做

解决方案 »

  1.   

    type abc=function():integer;stdcall;function test(lpCallBack:abc);integer;stdcall;external 'dll函数名称'function abc():integer;
    begin
    end;procedure 你自己的过程();
    var
      ii:integer;
    begin
      ii=test(@abc);
    end;
      

  2.   

    问题是他的类型不是abc,是longword  
    function test(lpCallBack:longword);integer;stdcall;external 'dll函数名称'
      

  3.   

    而且如果是abc也不对啊
    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.
      

  4.   

    我没看出来test和abc有什么关系。