关于动态调用dll的问题
hstod 2002-11-26 04:46:55 这是我的dll
library HDB;
uses ComCtrls;
procedure Look(Alistview:TlistView);stdcall;
var
i:integer;
Alist:Tlistitem;
begin
for i:=1 to 50 do
begin
Alist:=Alistview.Items.Add;
Alist.Caption:=inttostr(i);
end;
end;
exprots
look;
begin
end.
我在程序中调用
procedure TForm1.Button3Click(Sender: TObject);
var
Ahandle: Thandle;
AProc: procedure (Alistview:TlistView);stdcall;
begin
Ahandle:=loadlibrary('c:\HDB.dll');
if Ahandle<=0 then
showmessage('error1')
else begin
@Aproc:=getprocaddress(Ahandle,'Look');
if not assigned(@Aproc) then
showmessage('error2')
else
Aproc(listview1);
end;
Freelibrary(Ahandle);
end;
为什么每次进行提示错误!!!!好象就是 FreeLibrary(Ahandle)上!!