16,748
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.Button1Click(Sender: TObject);
type
Getfun=function (x,y:integer):dword;stdcall; ******这个什么意思?为啥没有函数名
var
DllHandle:Thandle; //DLL句柄
fun:Getfun; *****这个也不明白
begin
DllHandle:=loadlibrary('mydll.dll'); 加载DLL并返回句柄
if Dllhandle <>0 then
begin
try *****下面这句.如果需要指针.直接给指针地址不行么,如pinteger
@fun:=getprocaddress(DllHandle,'myfun'); //获得函数名入口地址,并返回地址
if Assigned(@Fun) then ****这句是检测是否给fun这个地址分配内存了么
begin
showmessage(inttostr(fun(2,2)));
end;
finally
freelibrary(dllhandle); //释放
end;
end
else
showmessage('未找到dll文件');
end;