十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Public Function EnumNetworkAdapters() As String
成都创新互联主要从事网站建设、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务东源,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
Try
Dim query As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher("SELECT * FROM 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("Description")) = False Then
EnumNetworkAdapters = mo.Item("Description") "|||"
End If
If IsDBNull(mo.Item("macaddress")) = False Then
If mo.Item("macaddress") "" Then
EnumNetworkAdapters = mo.Item("macaddress") "|||"
End If
End If
If IsDBNull(mo.Item("IPAddress")) = False Then
Dim temp As String
temp = Join(mo.Item("IPAddress"), ".")
If temp "" Then
EnumNetworkAdapters = temp "|||"
End If
End If
Next
Catch err A* **ception
EnumNetworkAdapters = err.Message err.StackTrace
End Try
End Function
Private Sub Form_Load()
Dim strComputer As String
Dim objWMI As Object
Dim colIP As Object
Dim IP As Object
Dim I As Integer
strComputer = "."
Set objWMI = GetObject("winmgmts://" strComputer "/root/cimv2")
Set colIP = objWMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
If Not IsNull(IP.IPAddress) Then
For I = LBound(IP.IPAddress) To UBound(IP.IPAddress)
MsgBox "IP地址:" IP.IPAddress(I) Chr(10) _
"网卡类型:" IP.Description(I) Chr(10) _
"网卡地址:" IP.Macaddress(I)
Next
End If
Next
End Sub
1、点击右侧的网络连接,在弹出的对话框中点击打开网络和共享中心。
2、在网络和共享中心界面中点击更改适配器设置。
3、进入网络连接界面,右键本地连接。
4、在弹出的菜单中选择属性。
5、在本地连接属性界面中点击配置按钮。
6、切换到高级选项卡,在属性列表中找到并点击网络地址,在右侧输入修改后的网络地址,点击确定按钮。
7、使用命令提示符,输入Ipconfig-all,可以查看修改后的物理地址。
Public Function EnumNetworkAdapters() As String
Try
Dim query As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher("SELECT * FROM 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("Description")) = False Then
EnumNetworkAdapters = mo.Item("Description") "|||"
End If
If IsDBNull(mo.Item("macaddress")) = False Then
If mo.Item("macaddress") "" Then
EnumNetworkAdapters = mo.Item("macaddress") "|||"
End If
End If
If IsDBNull(mo.Item("IPAddress")) = False Then
Dim temp As String
temp = Join(mo.Item("IPAddress"), ".")
If temp "" Then
EnumNetworkAdapters = temp "|||"
End If
End If
Next
Catch err AS Exception
EnumNetworkAdapters = err.Message err.StackTrace
End Try
End Function