vb.net 获取局域网计算机的当前用户名和计算机型号等信息
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
成都创新互联公司专业为企业提供绥棱网站建设、绥棱做网站、绥棱网站设计、绥棱网站制作等企业网站建设、网页设计与制作、绥棱企业网站模板建站服务,10余年绥棱做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
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
'用这种方法在远程获得再发回本机就可以吧
'取计算机型号暂时不会
在asp.net和vb.net中怎样提取mac 网卡地址?急~
暂时不知道,但是我觉得要是能解决的话就不会有那么多IP策略了
用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 获取指定网卡的网络连接状态
.net不能获得【指定】网卡的信息,给个思路,先遍历所有网卡,然后找到你需要的的那个网卡的信息。
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 怎么获取 所有网卡的 描述呢? 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取网卡名称的词条
链接分享:http://scgulin.cn/article/hppggi.html