Take MAC Address

Source: Internet
Author: User
Tags ord

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.