Delphi 通过 ARP 协议获取局域网内指定 IP 地址的机器的 MAC 地址


本文整理自网络,侵删。

 

function SendARP(ipaddr: ulong; temp: dword; ulmacaddr: pointer; ulmacaddrleng:
    pointer): dword; stdcall; external 'Iphlpapi.dll' Name 'SendARP';
 
function IP2Mac(ipaddr:ULong):String;
var
  AMac: array [0 .. 5] of BYTE;
  l: ulong;
  r: integer;
begin
  l:=6;  
  r := SendARP(ipaddr, 0, @AMac, @l);
  if r=0 then
    Result:=Format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x', [AMac[0], AMac[1], AMac[2], AMac[3], AMac[4],AMac[5]])
  else
    Result:='';
end;

来源:http://blog.qdac.cc/?p=2902

相关阅读 >>

Delphi mediaplayer1 播放avi 视频

Delphi tms web core twebhttprequest使用

Delphi中如何控制webbrowser滚动条

Delphi 中的颜色

键盘钩子,鼠标钩子,Delphi环境下编写的键盘鼠标钩子的程序示例

Delphi动态建立panel无法更改颜色?

Delphi写一个utf8编码格式的文本文件

Delphi treeview �c 自动给标题上加图片

Delphi更改android亮度

Delphi中coinitialize作用

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...