C#获取本机当前连接的无线路由的ssid
2009-02-14 16:15
411 查看
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;//System.Management.dll
namespace test_get_current_connect_console
{
class Program
{
static void Main(string[] args)
{
int i = 0;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root//WMI","SELECT * FROM MSNdis_80211_ServiceSetIdentifier where active = true");
try
{
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("MSNdis_80211_ServiceSetIdentifier instance");
Console.WriteLine("-----------------------------------");
if (queryObj["Ndis80211SsId"] == null)
Console.WriteLine("Ndis80211SsId: {0}", queryObj["Ndis80211SsId"]);
else
{
Byte[] arrNdis80211SsId = (Byte[])(queryObj["Ndis80211SsId"]);
Console.Write("Ndis80211SsId:");
foreach (Byte arrValue in arrNdis80211SsId)
{
if (i++ > 3)
{
if (arrValue > 0)
{
Console.Write("{0}", (char)arrValue);
}
}
}
Console.WriteLine("");
break;
}
}//end fereach
Console.ReadLine();
}
catch
{
Console.WriteLine("Error");
Console.ReadLine();
}
}// end Main
}//end class Program
}
参考:http://www.metageek.net/svn/Inssider/trunk/WmiWirelessInterface.cs<br /> http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/02e193f7-3f07-4c5c-9968-ac25ea96622b/
using System.Collections.Generic;
using System.Text;
using System.Management;//System.Management.dll
namespace test_get_current_connect_console
{
class Program
{
static void Main(string[] args)
{
int i = 0;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root//WMI","SELECT * FROM MSNdis_80211_ServiceSetIdentifier where active = true");
try
{
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("MSNdis_80211_ServiceSetIdentifier instance");
Console.WriteLine("-----------------------------------");
if (queryObj["Ndis80211SsId"] == null)
Console.WriteLine("Ndis80211SsId: {0}", queryObj["Ndis80211SsId"]);
else
{
Byte[] arrNdis80211SsId = (Byte[])(queryObj["Ndis80211SsId"]);
Console.Write("Ndis80211SsId:");
foreach (Byte arrValue in arrNdis80211SsId)
{
if (i++ > 3)
{
if (arrValue > 0)
{
Console.Write("{0}", (char)arrValue);
}
}
}
Console.WriteLine("");
break;
}
}//end fereach
Console.ReadLine();
}
catch
{
Console.WriteLine("Error");
Console.ReadLine();
}
}// end Main
}//end class Program
}
参考:http://www.metageek.net/svn/Inssider/trunk/WmiWirelessInterface.cs<br /> http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/02e193f7-3f07-4c5c-9968-ac25ea96622b/
相关文章推荐
- C#获取本机当前连接的无线路由的ssid (vista)
- iOS获取当前无线连接的SSID信息和WI-FI名称
- C#编程使用Managed Wifi API连接无线SSID
- 搜索不到无线路由的SSIDWin7如何连接隐藏SSID无线网络
- 获取连接无线路由客户机信息命令
- C#编程使用Managed Wifi API连接无线SSID & C#编程使用Managed Wifi API连接无线SSID
- IOS获取当前连接wifi(SSID...)
- C# 实现获取无线网络RSSI、SSID、BSSID
- C#编程使用Managed Wifi API连接无线SSID
- iOS获取当前连接的WiFi名称即SSID的方法
- C# 实现获取无线网络RSSI、SSID、BSSID
- C#获取执行程序所在的当前路径的方法
- C#中获取当前应用程序的路径及环境变量
- C#中获取当前CPU编号和线程名称
- C#获取当前路径的七种方法
- 如何在C#中获取“当前目录”
- 【转】C#获取电脑客户端IP地址及当前用户名
- Python实现获取当前公网ip并且自动断开宽带连接功能
- C#获取当前日期时间
- 获取SQL SERVER 当前连接,以及如何断开连接