hMod:=LoadLibrary(IPHLPAPI);
if hMod=0 then
Exit;
@SendARP:=GetProcAddress(hMod,'SendARP');
if not Assigned(SendARP) then
Exit;
try
IPStr:=IPAddress;
DestIP:=iNet_Addr(PChar(IPStr));
pMacAddr:=puLong(@MacAddr);
AddrLen:=SizeOf(MacAddr);
if SendARP(DestIP,0,pMacAddr,@AddrLen)=0 then
begin
s:='';
p:=PByte(pMacAddr);
if (p<>nil) and (AddrLen>0) then
begin
for i:=1 to AddrLen do
begin
s:=s+IntToHex(p^,2);
p:=Pointer(Integer(p)+SizeOf(Byte));
end;
SetLength(s,12);
end;
end;
Result:=s;
finally
FreeLibrary(hMod);
end;
end;