델파이 맥어드레스 추출 함수(MAC)

function tform1.fnGetMacAddress():String;
var
   UuidCreateFunc : function (var guid: TGUID):HResult;stdcall;
   handle : THandle;
   g:TGUID;
   WinVer:_OSVersionInfoA;
   i:integer;
   ErrCode: HResult;
begin
   WinVer.dwOSVersionInfoSize := sizeof(WinVer);
   getversionex(WinVer);

   handle := LoadLibrary('RPCRT4.DLL');
   if WinVer.dwMajorVersion >= 5 then {Windows 2000 }
      @UuidCreateFunc := GetProcAddress(Handle, 'UuidCreateSequential')
   else
      @UuidCreateFunc := GetProcAddress(Handle, 'UuidCreate') ;

   UuidCreateFunc(g);
   result:='';
   for i:=2 to 7 do
      result:=result+IntToHex(g.d4[i],2);
end;


출처 : http://www.zetblog.net/?0025840062

댓글

가장 많이 본 글