0

How get mac address all of adapter with delphi xe6? i get ip adreess

function MyFunction():String;
var
  registro  : TWSAData;
begin
  try
    WSAStartup(257, registro);
    Result := String(Trim(String(inet_ntoa(PInAddr(GetHostByName(nil)^.h_addr_list^ )^ ))));
    WSACleanup;
  except
    on Exp:Exception do
    begin
      Result := 'ERRO_IPCOMPUTADOR';
    end;
  end;
end;
Danilo Casa
  • 506
  • 1
  • 9
  • 18
  • And it seems like there are more help in this question http://stackoverflow.com/questions/325872/detect-an-internet-connection-activation-with-delphi/331421#331421 – Jens Borrisholt Nov 16 '15 at 14:16
  • Or this http://stackoverflow.com/questions/4550672/delphi-get-mac-of-router – David Heffernan Nov 16 '15 at 14:35
  • I will see and try it, thanks... – Felipe Sachetti Nov 16 '15 at 15:26
  • Since Windows XP, the preferred way to obtain adapters information is the [GetAdaptersAddresses function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx). I've provided an answer [here](https://stackoverflow.com/questions/577071/how-do-i-get-the-mac-address-of-a-network-card-using-delphi/33753784#33753784) showing its usage – fantaghirocco Nov 17 '15 at 09:54

0 Answers0