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://scyanting.com/article/hepojo.html