VB获取的MAC为什么是00-00-00-00-00-00??
找了几个代码试,都是00-00-00-00-00-00,真实的MAC是00e0-5d...
为什么会出现全0现象呢?求高手指点
[解决办法]
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