vb.net读取mac vbs文件读写-成都快上网建站

vb.net读取mac vbs文件读写

用vb.net如何取得mac地址?

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

创新互联是一家专业提供清河企业网站建设,专注与成都网站建设、网站设计、HTML5建站、小程序制作等业务。10年已为清河众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。

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

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

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

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


文章名称:vb.net读取mac vbs文件读写
标题来源:http://kswjz.com/article/hepojo.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流