这个问题你们遇到过吗? (30分)

黑狼

Unregistered / Unconfirmed
GUEST, unregistred user!
以下我是参照一本delphi书写的一个DLL源代码!
library dll;

uses
SysUtils,Classes,winprocs;
type
TfoundStrProc=procedure(strpos:pchar);stdcall;

{$R *.res}
function searchstr(asrcstr,aseachstr:pchar;aproc:tfarproc):integer;stdcall;
var
findstr:pchar;
begin
findstr:=asrcstr;
findstr:=strpos(findstr,aseachstr);
while findstr<>nil do
begin
if aproc<>nil then
//为什么用过程作类型转换时,必须加上findstr,这个参数是什么意思。
TfoundStrProc(aproc)(findstr);
findstr:=findstr+1;
findstr:=strpos(findstr,aseachstr);
end;
end;

exports
searchstr;

begin
end.
 
TCallBack = procedure (SetCall: PChar) of Object;
 
谢谢楼上仁兄的回答,不过我的源代码没有写错!
我的意思是用这个函数tcallback做强制转换类型时,为什么会出错!
 
出错的原因就是“缺少参数”啊,tcallback(callback)(i);是执行一个函数,你写的tcallback(callback);是什么意思啊?
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
582
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
723
import
I
I
回复
0
查看
651
import
I
顶部