Uses Nb30;
Usually with the default of 0 can be
functionGetmacaddress (ConstIndex:integer =0):string;varNCB:TNCB; {NetBIOS Control block}Adapters:tadapterstatus;{NIC Status Structure}Lananum:tlanaenum; {Netbios Lana}I:integer; Rc:char; {return code for NetBIOS}str:string;beginResult:="'; TryZeroMemory (@ncb, SizeOf (NCB)); {NetBIOS control block Clear 0}Ncb.ncb_command:= Chr (ncbenum);{ENUM}RC:= NetBios (@ncb);{Fetch return Code}Ncb.ncb_buffer:= @LanaNum;{processing the enum command once more}ncb.ncb_length:=SizeOf (Lananum); RC:= NetBios (@ncb);{Fetch return Code} ifORD (RC) <>0 ThenExit; ZeroMemory (@ncb, SizeOf (NCB)); {NetBIOS control block Clear 0}Ncb.ncb_command:=chr (ncbreset); Ncb.ncb_lana_num:=Lananum.lana[index]; RC:=NetBios (@ncb); ifOrd (RC) <>0 ThenExit; ZeroMemory (@ncb, SizeOf (NCB)); {to take the status of the NIC}Ncb.ncb_command:=chr (NCBASTAT); Ncb.ncb_lana_num:=Lananum.lana[index]; Strpcopy (Ncb.ncb_callname,'*'); Ncb.ncb_buffer:=@AdapterS; Ncb.ncb_length:=SizeOf (adapters); RC:=NetBios (@ncb); STR:="';{convert MAC address to string} fori:=0 to 5 DoStr:= str + inttohex (Integer (Adapters.adapter_address[i]),2); Result:=str; ifResult <>"' Then beginResult:=copy (Result,1,2)+'-'+copy (Result,3,2) +'-'+copy (Result,5,2) +'-'+copy (Result,7,2) +'-'+copy (Result,9,2)+'-'+copy (Result, One,2) End; finally End;End;
Take MAC Address