Hi
Is there a function in Indy whereby i could get the Mac address of the interface card?
Or is there any function in Delphi whereby i could obtain the MAC address of the NIC card for FMX app?
regards
chris
I don't know with Indy, but in Delphi there are the WinApi.IPHlpApi e WinAPi.IPTypes that are acquired from Project JEDI.
You must enumerate the Interface cards and looks for properties:
Uses WinAPi.IpHlpApi, WinApi.IpTypes;
var
NumInterfaces: Cardinal;
AdapterInfo: array of TIpAdapterInfo;
OutBufLen: ULONG;
begin
GetNumberOfInterfaces(NumInterfaces);
SetLength(AdapterInfo, NumInterfaces);
OutBufLen := NumInterfaces * SizeOf(TIpAdapterInfo);
GetAdaptersInfo(@AdapterInfo[0], OutBufLen);
for var i := 0 to NumInterfaces - 1 do
begin
(* These are the 6 bytes MAC Addresses of Interfaces
AdapterInfo[i].Address[0], AdapterInfo[i].Address[1]
AdapterInfo[i].Address[2], AdapterInfo[i].Address[3]
AdapterInfo[i].Address[4], AdapterInfo[i].Address[5]
*)
end;
end;
EDIT: This works only in Windows platforms.