标题:求助:请问如何获取网址的物理地址(MAC地址)?
只看楼主
桃源书生
Rank: 1
等 级:新手上路
帖 子:99
专家分:3
注 册:2006-7-3
结帖率:33.33%
 问题点数:0 回复次数:1 
求助:请问如何获取网址的物理地址(MAC地址)?
rt,谢谢!
搜索更多相关主题的帖子: 物理 MAC 网址 地址 获取 
2008-04-09 15:00
anthony634
Rank: 6Rank: 6
来 自:西南交大
等 级:贵宾
威 望:24
帖 子:653
专家分:10
注 册:2006-6-8
得分:0 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,nb30;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
Var
  NCB : TNCB;
  ADAPTER : TADAPTERSTATUS;
  LANAENUM : TLANAENUM;
  intIdx : Integer;
  re : Char;
  buf : String;
begin
  Try
    ZeroMemory(@NCB, SizeOf(NCB));
    NCB.ncb_command := Chr(NCBRESET);
    NCB.ncb_lana_num := LANAENUM.lana[0];
    re := NetBios(@NCB);
    If Ord(re)<>0 Then
      exit;
    ZeroMemory(@NCB, SizeOf(NCB));
    NCB.ncb_command := Chr(NCBASTAT);
    NCB.ncb_lana_num := LANAENUM.lana[0];
    StrPCopy(NCB.ncb_callname, '*');
    NCB.ncb_buffer := @ADAPTER;
    NCB.ncb_length := SizeOf(ADAPTER);
    re := NetBios(@NCB);
    If Ord(re)<>0 Then
      exit;

    buf := '';
    For intIdx := 0 To 5 Do
      buf := buf + InttoHex(Integer(ADAPTER.adapter_address[intIdx]),2)+'-';
    edit1.Text := copy(buf,0,length(buf)-1);
  Finally
  End;

end;

end.
2008-04-09 18:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-207995-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.354300 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved