IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Delphi (https://www.ircforumlari.net/delphi/)
-   -   Bilgisayarın MAC Adresini Almak (https://www.ircforumlari.net/delphi/124777-bilgisayarin-mac-adresini-almak.html)

Cemalizim 21 Temmuz 2008 19:42

Bilgisayarın MAC Adresini Almak
 
PHP- Kodu:

ses NB30;
 
function 
GetAdapterInfo(LanaChar): String;
var
 
AdapterTAdapterStatus;
 
NCBTNCB;
begin
 FillChar
(NCBSizeOf(NCB), 0);
 
NCB.ncb_command := Char(NCBRESET);
 
NCB.ncb_lana_num := Lana;
 if 
Netbios(@NCB) <> Char(NRC_GOODRETthen
 begin
   Result 
:= 'mac not found';
   Exit;
 
end;
 
 
FillChar(NCBSizeOf(NCB), 0); 
 
NCB.ncb_command := Char(NCBASTAT); 
 
NCB.ncb_lana_num := Lana
 
NCB.ncb_callname := '*'
 
 
FillChar(AdapterSizeOf(Adapter), 0);
 
NCB.ncb_buffer := @Adapter
 
NCB.ncb_length := SizeOf(Adapter); 
 if 
Netbios(@NCB) <> Char(NRC_GOODRETthen 
 begin 
   Result 
:= 'mac not found'
   Exit; 
 
end
 
Result := 
   
IntToHex(Byte(Adapter.adapter_address[0]), 2) + '-' +
   
IntToHex(Byte(Adapter.adapter_address[1]), 2) + '-' 
   
IntToHex(Byte(Adapter.adapter_address[2]), 2) + '-' 
   
IntToHex(Byte(Adapter.adapter_address[3]), 2) + '-' 
   
IntToHex(Byte(Adapter.adapter_address[4]), 2) + '-' 
   
IntToHex(Byte(Adapter.adapter_address[5]), 2); 
end
 
function 
GetMACAddressstring;
var
 
AdapterListTLanaEnum
 
NCBTNCB
begin 
 FillChar
(NCBSizeOf(NCB), 0); 
 
NCB.ncb_command := Char(NCBENUM); 
 
NCB.ncb_buffer := @AdapterList
 
NCB.ncb_length := SizeOf(AdapterList); 
 
Netbios(@NCB); 
 if 
Byte(AdapterList.length) > 0 then
   Result 
:= GetAdapterInfo(AdapterList.lana[0]) 
 else 
   
Result := 'mac not found'
end
 
// usage
procedure TForm1.Button1Click(SenderTObject);
begin
  ShowMessage
(GetMACAddress);
end

alıntı


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 23:58.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk