怎样获得mac地址啊?(10分)

  • 主题发起人 主题发起人 adidas2008
  • 开始时间 开始时间
A

adidas2008

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样获得mac地址啊?请给出实例代码和某个可用的类库!
 
procedure NBGetMac(strings:Tstrings);
function HexBL(by:Byte):string;
begin
result:=format('%x',[by]);
if length(result)<2 then
result:='0'+result;
end;
var
NCB:TNCB;
Adapter:TAdapterStatus;
LanaEnum:TLanaEnum;
I,J:Integer;
Str:String;
begin
strings.clear;
ZeroMemory(@NCB,sizeof(NCB));
NCB.ncb_command:=chr(NCBENUM);
NetBios(@NCB);
NCB.ncb_buffer:=@LanaEnum;
NCB.ncb_length:=sizeof(lanaEnum);
NCB.ncb_command:=chr(NCBENUM);
NetBios(@NCB);
for i:=0 to ord(LanaEnum.length)-1do
begin
zeromemory(@NCB,sizeof(NCB));
NCB.ncb_command:=chr(NCBRESET);
NCB.ncb_lana_num:=lanaEnum.lana;
netbios(@NCB);
zeromemory(@NCB,sizeof(NCB));
NCB.ncb_command:=chr(NCBSTART);
NCB.ncb_Lana_num:=LanaEnum.lana;
strPcopy(NCB.ncb_callname,'*');
NCB.ncb_buffer:=@Adapter;
NCB.ncb_length:=sizeof(Adapter);
netbios(@NCB);
str:='';
for j:=0 to 5do
begin
if j>0 then
str:=str+'-';
str:str+HexBL(byte(adapter.adapter_address[j]));
end;
strings.add(str);
end;
end;
 
这个东东怎么在java中使用啊?
 
后退
顶部