在DELPHI中如何获取其它主机的MAC地址?(50分)

L

ling_yu

Unregistered / Unconfirmed
GUEST, unregistred user!
如果知道对方的IP地址,在DELPHI中如何获取它的MAC地址?如有程序代码参考最好,谢谢!另外如果知道主机的MAC地址,如何知道它是否正在上网?
 
哪位大侠给个提示或代码参考参考,先谢谢啦!!
 
也是以前论坛上的,试试看
function GetMAC: string;
var
Lib: Cardinal;
Func: function(GUID: PGUID): Longint;
StdCall;
GUID1, GUID2: TGUID;
begin
try
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
@Func := GetProcAddress(Lib, 'UuidCreate')
else
@Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
begin
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) + '.' +
IntToHex(GUID1.D4[3], 2) + '.' +
IntToHex(GUID1.D4[4], 2) + '.' +
IntToHex(GUID1.D4[5], 2) + '.' +
IntToHex(GUID1.D4[6], 2) + '.' +
IntToHex(GUID1.D4[7], 2);
end;
end;
FreeLibrary(Lib);
end;
except
Result := '';
Application.ProcessMessages;
end;
end;
 
顶部