如题/

解决方案 »

  1.   

    function GetPhysicalAddress: string;
    Var
      NCB : TNCB;
      ADAPTER : TADAPTERSTATUS;
      LANAENUM : TLANAENUM;
      intIdx : Integer;
      re : Char;
      buf : String;
    begin
      Try
    {    ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBENUM);
        re := NetBios(@NCB);    // Reissue enum command
        NCB.ncb_buffer := @LANAENUM;
        NCB.ncb_length := SizeOf(LANAENUM);
        re := NetBios(@NCB);
        If Ord(re)<>0 Then
          exit;
     }
     { Copyright (C) Bowman }
     { [email protected] }
        // Reset adapter
        ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBRESET);
        NCB.ncb_lana_num := LANAENUM.lana[0];//important
        re := NetBios(@NCB);
        If Ord(re)<>0 Then
        begin
          Result := '';
          exit;
        end;
        // Get adapter address
        ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBASTAT);
        NCB.ncb_lana_num := LANAENUM.lana[0];////bowman
        StrPCopy(NCB.ncb_callname, '*');
        NCB.ncb_buffer := @ADAPTER.adapter_address[0];
        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)+'-';
        Result := copy(buf,0,length(buf)-1);
      finally
      //  freemem(@NCB,SizeOf(NCB));
      end;
    end;
      

  2.   

    mac地址吗?
    我想如果是的话
    http://www.8421.org/download.php?id=147
      

  3.   

    Wally_wu(韦利) ,你的根本读不出来,就算我不拔掉网线
      

  4.   

    sunny518(灵犀) ,你那个只是WIN2000,而我要的只XP。
      

  5.   

    nbtstat -A xx.xx.xx.xx > a.txt读取A.txt内容类似如下
    Node IpAddress: [10.103.111.134] Scope Id: []           NetBIOS Remote Machine Name Table       Name               Type         Status
        ---------------------------------------------
        RUSTLE         <00>  UNIQUE      Registered
        RUSTLE         <20>  UNIQUE      Registered
        SPIC           <00>  GROUP       Registered
        RUSTLE         <03>  UNIQUE      Registered
        SPIC           <1E>  GROUP       Registered
        INet~Services  <1C>  GROUP       Registered
        IS~RUSTLE......<00>  UNIQUE      Registered    MAC Address = 00-E0-4C-90-E3-B0
      

  6.   

    自己写程序的话:
    参考一下VC的做法,差不多的
      http://www.pcvc.net/category/content.asp?sendid=229
      

  7.   

    调用命令行命令
    ipconfig/all
      

  8.   

    Try this
    (Delphi6)....
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls, nb30;implementation{$R *.dfm}function TForm1.NBGetAdapterAddress(a :Integer): string;
    var
      NC :TNCB;
      ADAPTE :TADAPTERSTATUS;
      LANAENU :TLANAENUM;
      intId :Integer;
      cR :Char;
      strTem :string;
    begin
      Result := '';
      try
        ZeroMemory(@NC, SizeOf(NC));
        NC.ncb_command := Chr(NCBENUM);
        cR := NetBios(@NC);    //Reissue enum command
        NC.ncb_buffer := @LANAENU;
        NC.ncb_length := SizeOf(LANAENU);
        cR := NetBios(@NC);
        If Ord(cR) <> 0 then
          exit;    ZeroMemory(@NC, SizeOf(NC));
        NC.ncb_command := Chr(NCBRESET);
        NC.ncb_lana_num := LANAENU.lana[a];
        cR := NetBios(@NC);
        if Ord(cR) <> 0 then
          exit;    ZeroMemory(@NC, SizeOf(NC));
        NC.ncb_command := Chr(NCBASTAT);
        NC.ncb_lana_num := LANAENU.lana[a];
        StrPCopy(NC.ncb_callname, '*');
        NC.ncb_buffer := @ADAPTE;
        NC.ncb_length := SizeOf(ADAPTE);
        cR := NetBios(@NC);
        strTem := '';
        for intId := 0 To 5 do
          strTem := strTem+ InttoHex(Integer(ADAPTE.adapter_address[intId]), 2);
        Result := strTem;
      finally
      end;end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit1.Text := NBGetAdapterAddress(0);
      Beep;
    end;
      

  9.   

    谁说的﹐我还运行通过﹕
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, nb30;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}
    function GetPhysicalAddress: string;
    Var
      NCB : TNCB;
      ADAPTER : TADAPTERSTATUS;
      LANAENUM : TLANAENUM;
      intIdx : Integer;
      re : Char;
      buf : String;
    begin
      Try
    {    ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBENUM);
        re := NetBios(@NCB);    // Reissue enum command
        NCB.ncb_buffer := @LANAENUM;
        NCB.ncb_length := SizeOf(LANAENUM);
        re := NetBios(@NCB);
        If Ord(re)<>0 Then
          exit;
     }
     { Copyright (C) Bowman }
     { [email protected] }
        // Reset adapter
        ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBRESET);
        NCB.ncb_lana_num := LANAENUM.lana[0];//important
        re := NetBios(@NCB);
        If Ord(re)<>0 Then
        begin
          Result := '';
          exit;
        end;
        // Get adapter address
        ZeroMemory(@NCB, SizeOf(NCB));
        NCB.ncb_command := Chr(NCBASTAT);
        NCB.ncb_lana_num := LANAENUM.lana[0];////bowman
        StrPCopy(NCB.ncb_callname, '*');
        NCB.ncb_buffer := @ADAPTER.adapter_address[0];
        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)+'-';
        Result := copy(buf,0,length(buf)-1);
      finally
      //  freemem(@NCB,SizeOf(NCB));
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      showmessage(GetPhysicalAddress);
    end;end.
      

  10.   

    Wally_wu(韦利) ,运行是通过,读出来是空的,什么也没有,我现在试的机器是win2000 server .
      

  11.   

    swayi21(微斯人),你的读的不是真正的物理地址。在win 2000上根本不对。像你们前面的程序我以前就查过的。我有一个获取物理地址的程序,可以在win98,win 2000,下(是否拔掉网线)都能读出来,惟独win xp下拔掉网线读不出来,若是插上网线都能读的出来。