在CSDN里找到了获取一个MAC地址的方法,但不好用,有时读不出网卡MAC,不知为什么,哪位有好点的方法,请指点,谢了

解决方案 »

  1.   

    Sub wmiGetMac()
      Dim WmiObjSet, Obj
      Set WmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                                InstancesOf("Win32_NetworkAdapterConfiguration")
      On Local Error Resume Next
      For Each Obj In WmiObjSet
          MsgBox Obj.MACAddress
          MsgBox Obj.Description
          MsgBox Obj.DNSHostName
          MsgBox Obj.DNSDomain
          If Not IsNull(Obj.IPAddress) Then
             For i = 0 To UBound(Obj.IPAddress)
                 MsgBox "IP address:" & Obj.IPAddress(i)
             Next
          End If
      Next
    End Sub
      

  2.   

    DNS不能显示,解决后一定送上全分
      

  3.   

    http://community.csdn.net/Expert/topic/5333/5333574.xml?temp=.9415247