用LoadLibrary获得DLL的句柄,用GetProcAddress获得DLL中例程的地址。
比如,你现在有个DllName.dll的DLL,并且里面有个Getcount的函数。如下:
procedure TForm1.Button1Click(Sender:TObject);
Var
LibHandle: THandle;
FunAddress: Function(Index:Integer):Integer;Stdcall;
Count: Integer;
begin
LibHandle:=LoadLibrary(PChar(DllName);
FunAddress:=GetProcAddress(LibHandle,'GetCount');
Count:=FunAddress(2);
end;