delphi动态调用DLL
发布网友
发布时间:2023-07-12 17:41
我来回答
共2个回答
热心网友
时间:2024-11-07 16:51
var
dll:Cardinal;
pp:function(x,y:integer):integer;
begin
dll:=LoadLibrary(PChar('xx.dll'));
if dll<>0 then
begin
@pp:=GetProcAddress(dll, 'abc');
if @pp<>nil then
Edit3.Text:=inttostr(pp(strtoint(Edit1.Text),strtoint(Edit2.text)));
FreeLibrary(dll);
end;
end;
热心网友
时间:2024-11-07 16:52
Type
TkillPro=procere;
//...
var
LibHandle:
THandle;
pro:TKillPro;
DLLFile:string;
begin
DLLFile:='你的DLL文件路径';
LibHandle:=LoadLibrary(pchar(DLLFile));
if
LibHandle<>HINSTANCE_ERROR
then
begin
@pro:=GetProcAddress(LibHandle,'Kill');
if
not
(@pro=nil)
then
Pro;//调用...
end;
end;