Zitat:
Dann werd' ich mich mal nach der MAC-Adressen-Abfrage tummeln.
Also ich mache das folgendermaßen:
Delphi-Quellcode:
unit arp;
interface
uses
sysutils, windows, winsock;
type
TMacAddr =
Array[0..5]
of char;
function SendARP(DestIP: u_long; SrcIP: u_long;
var MacAddr: TMacAddr;
var Len: u_long): DWORD;
stdcall;
external '
iphlpapi.dll';
function GetMacByIp(
const IP:
String):
String;
implementation
function GetMacByIp(
const IP:
string):
String;
var
Mac: TMacAddr;
i: Integer;
L: integer;
S:
String;
begin
for i := 0
to 5
do
Mac[i] := #0;
L := SizeOf(TMacAddr);
SendARP(inet_addr(PChar(
IP)), inet_addr(PChar('
localhost')), Mac, L);
S := '
';
for i := 0
to 5
do
S := S + IntToHex(Ord(Mac[i]), 2) + '
.';
Delete(S, Length(S), 1);
result := S;
end;
end.