Endereço mac do pc

Delphi

14/09/2012

Ola, como faz no delphi para buscar o endereço mac o pc?

obrigado.
Wilton Júnior

Wilton Júnior

Curtidas 0

Respostas

Joel Rodrigues

Joel Rodrigues

14/09/2012

Dá uma olhada nesse link: http://www.swissdelphicenter.ch/torry/showcode.php?id=651
Acho que pode te ajudar.
GOSTEI 0
Singular Ti

Singular Ti

14/09/2012

Ola amigo... Segue uma funcão para retornar uma string com o valor do MacAddress do pc..

function MacAddress: string;
var
  Lib: Cardinal;
  Func: function(GUID: PGUID): Longint; stdcall;
  GUID1, GUID2: TGUID;
begin
  Result := '';
  Lib := LoadLibrary('rpcrt4.dll');
  if Lib <> 0 then
  begin
    @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;
  end;
end;


Abraços!!!!
GOSTEI 0
Wilton Júnior

Wilton Júnior

14/09/2012

Funciona legal, obrigado
Deus o abençoe.
GOSTEI 0
Joel Rodrigues

Joel Rodrigues

14/09/2012

Que bom que resolveu.
Estou encerrando o tópico.
GOSTEI 0
POSTAR