这个资料你看看吧<br>可以采用三种方式:<br>1、98下,采用GUID;<br>2、2000,XP下,通过ARP或UDP<br>举个例子:<br>用ARP,FIPAddr=你的网卡捆绑的IP<br>...<br>implementation<br>function inet_addr(const cp: PChar): DWord; stdcall; external 'WS2_32.DLL' name 'inet_addr';<br>function SendARP(const DestIP: DWord;<br> const SrcIP: DWord;<br> const pMacAddr: Pointer;<br> const PhyAddrLen: PULONG): DWord; stdcall; external 'IPHLPAPI.dll' name 'SendARP';<br><br>{$R *.dfm}<br>function TForm1.GetMacByIP(FIPAddr: string): string;<br>... <br><br>function TForm1.GetMacByIP(FIPAddr: string): string;<br>var<br> dwResult: DWord;<br> ulIPAddr: DWord;<br> ulMacAddr: array[0..5] of Byte;<br> ulAddrLen: ULONG;<br>begin<br> ulIPAddr := INet_Addr(PChar(FIPAddr));<br><br> if ulIPAddr = INADDR_NONE then<br> exit;<br> ulAddrLen := 6;<br> dwResult := SendARP(ulIPAddr, 0, @ulMacAddr, @ulAddrLen);<br><br> if dwResult = 0 then<br> result := (IntToHex(ulMacAddr[0], 2) + ':' +<br> IntToHex(ulMacAddr[1], 2) + ':' +<br> IntToHex(ulMacAddr[2], 2) + ':' +<br> IntToHex(ulMacAddr[3], 2) + ':' +<br> IntToHex(ulMacAddr[4], 2) + ':' +<br> IntToHex(ulMacAddr[5], 2))<br> else<br> result := '';<br>end;