Foxtable(狐表)用户栏目专家坐堂 → MAC问题请教


  共有2123人关注过本帖平板打印复制链接

主题:MAC问题请教

帅哥哟,离线,有人找我吗?
pyh6918
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1128 积分:11035 威望:0 精华:2 注册:2008/9/1 10:45:00
MAC问题请教  发帖心情 Post By:2020/8/25 12:58:00 [只看该作者]

想使用MAC码作为注册依据,在论坛查了一下,发现了好几种获取MAC的方法,我只会使用,不懂原理,不知道哪种方法稳定并适合W7、W8、W10,请指教?
1:
Dim query As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher("SEL ECT * FR OM Win32_NetworkAdapterConfiguration")
Dim queryCollection As System.Management.ManagementObjectCollection = query.Get()
Dim mo As New System.Management.ManagementObject
For Each mo In queryCollection
    If IsDBNull(mo.Item("macaddress")) = False Then
        If mo.Item("macaddress") <> "" AndAlso mo.Item("IPEnabled") Then
            output.show(mo.Item("macaddress"))
        End If
    End If
Next

2:
Dim nics() As System.Net.NetworkInformation.NetworkInterface = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
output.show(nics(0).GetPhysicalAddress.Tostring) '获得MAC地址
output.show(nics.length)

 回到顶部