快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vb.net换mac地址 vb获取mac地址

vb.net获取本地连接的mac地址

Private Sub Form_Load()

创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站建设、成都网站设计、巴东网络推广、小程序制作、巴东网络营销、巴东企业策划、巴东品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供巴东建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com

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如何取得mac地址?

这是C#的,你可以转换一下

using System.Management;

//获取网卡的系列号

private static string GetMacAddress()

{

string ret = "";

try

{

ManagementClass cimobject = new ManagementClass("Win32_NetworkAdapterConfiguration");

ManagementObjectCollection moc = cimobject.GetInstances();

if (moc.Count == 0)

return "";

else

{

foreach (ManagementObject mo in moc)

{

if ((bool)mo["IPEnabled"] == true)

{

ret = (string)mo.Properties["MacAddress"].Value;

break;

}

}

}

}

catch

{

ret = "";

}

return ret;

}

VB.NET 如何修改mac地址

首先MAC地址在网卡中是固定的,可以修改,但通常不进行修改,通过vb.net修改的方式并不清楚但在XP或者W2000里面可以通过更改注册表进行修改

vb.net怎么获取网卡MAC地址?

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 A* **ception

EnumNetworkAdapters = err.Message err.StackTrace

End Try

End Function

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地址

你可以使用WMI来获取MAC ID。。加上一些特定的条件也可以实现获取WLAN MAC_ID


当前文章:vb.net换mac地址 vb获取mac地址
路径分享:http://6mz.cn/article/hpdicd.html

其他资讯