使用WMI对象为什么提取不到计算机的MAC地址
Private Sub cmdGetMAC_Click()Dim strmac As String
Dim objwmiservice As Object
Dim colitems As Object
Dim objitem As Object
Set objwmiservice = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set colitems = objwmiservice.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objitem In colitems
strmac = objitem.macaddress
lstMAC.AddItem Replace(Trim(strmac), ":", "-")
Next
End Sub