黑
黑狼
Unregistered / Unconfirmed
GUEST, unregistred user!
以下我是参照一本delphi书写的一个DLL源代码!
library dll;
uses
SysUtils,Classes,winprocs;
type
TfoundStrProc=procedure(strposchar);stdcall;
{$R *.res}
function searchstr(asrcstr,aseachstrchar;aproc:tfarproc):integer;stdcall;
var
findstrchar;
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.
library dll;
uses
SysUtils,Classes,winprocs;
type
TfoundStrProc=procedure(strposchar);stdcall;
{$R *.res}
function searchstr(asrcstr,aseachstrchar;aproc:tfarproc):integer;stdcall;
var
findstrchar;
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.