主题:获取物理地址问题
在 XP 系统如下代码可以正确获取计算机的物理地址:
LOCAL oWMI AS OBJECT,oLocal AS OBJECT,oHARDWARE AS OBJECT,object1 AS OBJECT,lcCPUID,LcMAC,lcHDID,lcSerial
oWMI=CREATEOBJECT("WbemScripting.SWbemLocator")
oLocal=oWMI.ConnectServer(".", "root\cimv2")
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=1")
FOR EACH object1 IN oHARDWARE
LcMAC=object1.Properties_('MACAddress').VALUE
EXIT
ENDFOR
最近在安装 WIN7 的计算机上运行,却无法获取到物理地址,反回值 .F.
请教:
1.是因为 WIN7 的问题,还是
2.由于新计算机网卡已配备 IPv6 兼容,从而无法用上面的代码获得物理地址
请教各位老师如何解决。
谢谢!
LOCAL oWMI AS OBJECT,oLocal AS OBJECT,oHARDWARE AS OBJECT,object1 AS OBJECT,lcCPUID,LcMAC,lcHDID,lcSerial
oWMI=CREATEOBJECT("WbemScripting.SWbemLocator")
oLocal=oWMI.ConnectServer(".", "root\cimv2")
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=1")
FOR EACH object1 IN oHARDWARE
LcMAC=object1.Properties_('MACAddress').VALUE
EXIT
ENDFOR
最近在安装 WIN7 的计算机上运行,却无法获取到物理地址,反回值 .F.
请教:
1.是因为 WIN7 的问题,还是
2.由于新计算机网卡已配备 IPv6 兼容,从而无法用上面的代码获得物理地址
请教各位老师如何解决。
谢谢!