vb.net获取mac,vb从网页获取数据
vb.net获取本地连接的mac地址
Private Sub Form_Load()
创新互联长期为超过千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为曲阜企业提供专业的成都网站制作、成都网站设计,曲阜网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。
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
VB.NET 获取网关IP MAC地址
我找了一些C# 的VB。NET 貌似很少不过都是。NET 平台。你看看吧都应该通用的。
添加对System.Management的引用
using System.Management;
。。。
//获取IP,子网掩码(subnet mask)和默认网关
ManagementClass mc = new ManagementClass( "Win32_NetworkAdapterConfiguration ");
ManagementObjectCollection nics = mc.GetInstances();
foreach(ManagementObject nic in nics)
{
if(Convert.ToBoolean(nic[ "ipEnabled "]) == true)
{
Console.WriteLine((nic[ "IPAddress "] as String[])[0]);
Console.WriteLine((nic[ "IPSubnet "] as String[])[0]);
Console.WriteLine((nic[ "DefaultIPGateway "] as String[])[0]);
}
}
获取硬件信息源代码:
获取硬件信息演示程序:
汉化
利用using System.Management类来获取相应的硬件知识
其实这类东西很容易找到答案的,方法非常多,最常见的API模式,你去搜索吧,保证一把一把的
用vb.net如何取得mac地址?
刚刚我自己写了一段 是引用System.net 来做的 我不喜欢用WMI 主要是查出来的信息不准确,下面我附上源码 希望可以加分给我
Imports System.Net
Imports System.Net.NetworkInformation
Public Class Form1
Private Sub btnGetMac_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetMac.Click
Dim NetworkInterfaces() As NetworkInterface
NetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces()
If NetworkInterfaces.Length 0 Then
For Each NetWork In NetworkInterfaces
txtMac.Text = txtMac.Text +
"MAC地址:" + NetWork.GetPhysicalAddress().ToString() + Environment.NewLine +
"网络连接:" + NetWork.Name + Environment.NewLine +
"网卡序列号:" + NetWork.Id + Environment.NewLine +
"网络类型:" + NetWork.NetworkInterfaceType.ToString() + Environment.NewLine +
"网络速度:" + (NetWork.Speed / 1000000).ToString() + "MB" + Environment.NewLine
Next
End If
End Sub
End Class
分享名称:vb.net获取mac,vb从网页获取数据
文章网址:http://scjbc.cn/article/hspdoc.html