1,184
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.Button1Click(Sender: TObject);
type
TIntFunc = function(i: integer): integer; stdcall;
var
Th: Thandle;
Tf: TIntFunc;
Tp: TFarProc;
begin
Th := LoadLibrary('ZLDS200_TCP_DLL.dll'); {装载DLL}
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, PChar('ZLDS200Connect'));
if Tp <> nil then
begin
Tf := TIntFunc(Tp);
IntToStr(Tf(620)); {调用ZLDS200Connect函数}
end
else
ShowMessage('ZLDS200Connect函数没有找到');
finally
FreeLibrary(Th); {释放DLL}
end;
end
else
ShowMessage('ZLDS200_TCP_DLL.dll没有找到');
end;