在asp.net和vb.net中怎样提取mac 网卡地址?急~暂时不知道vb.net取网卡名称,但是我觉得要是能解决vb.net取网卡名称的话就不会有那么多IP策略vb.net取网卡名称了
vb.net 获取指定网卡的网络连接状态.net不能获得【指定】网卡的信息 , 给个思路,先遍历所有网卡,然后找到你需要的的那个网卡的信息 。
电脑有两张网卡 。如何用vb.net分别获取网卡的IP?求大神明路!'要使得引用System.Management有效,先通过菜单
'[项目]--[添加引用],在“.Net”选项卡里,选择“System.Management”,单击[确定]
Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")
For Each MySearcherObj As ManagementObject In MySearcher.Get
If CBool(MySearcherObj("IPEnabled")) Then
MsgBox(MySearcherObj("IPAddress")(0))
End If
Next
End Sub
End Class
vb.net 获取局域网计算机的当前用户名和计算机型号等信息Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub GetName()
Dim sJM As String
Dim sMC As String
Dim sIP As String
Dim s As String
s = String(128, Chr(0))
GetComputerName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sJM = s'计算机名称
s = String(128, Chr(0))
GetUserName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sMC = s‘当前用户名称
End Sub
'用这种方法在远程获得再发回本机就可以吧
'取计算机型号暂时不会
vb.net 如何获取指定IP的网卡地址MACPublic 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.Messageerr.StackTrace
End Try
End Function
求大神指点 vb.net 怎么获取 所有网卡的 描述呢? vbs 的也可以Private Sub GetMyIP()
Dim strComputer As String
Dim objWMI As Object
Dim colIP As Object
Dim IP As Object
Dim I As Integer
strComputer = "."
objWMI = GetObject("winmgmts://"strComputer"/root/cimv2")
colIP = objWMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
If Not IsNothing(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
【vb.net取网卡名称 vb禁用网卡】vb.net取网卡名称的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb禁用网卡、vb.net取网卡名称的信息别忘了在本站进行查找喔 。
推荐阅读
- 保护子宫瑜伽直播话术,保养子宫的最好瑜伽方法视频
- 家庭拍摄用什么相机,家庭拍摄买什么相机好
- 穿越火线直播用什么cpu,穿越火线直播用什么显卡
- go语言构建 go语言创建项目
- 熟练使用linux命令,熟悉linux操作
- 关于3988棋牌游戏的信息
- 微信为什么要视频号关注,微信为什么要视频号关注才能看到
- mysql横线怎么解决 mysql横表和竖表优缺点
- 直播用户都是什么类型,直播用户来源