获取无线网络,我在Windows Vista上连接到与C#.NET的SSID [英] Get SSID of the wireless network I am connected to with C# .Net on Windows Vista

查看:207
本文介绍了获取无线网络,我在Windows Vista上连接到与C#.NET的SSID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何.NET类,允许我知道无线网络,我连接的SSID。
到目前为止,我只发现下面链接库。是最好的,我可以得到或者我应该用别的东西吗?
管理的WiFi HTTP ://www.$c$cplex.com/managedwifi

I'd like to know if there is any .Net class that allows me to know the SSID of the wireless network I'm connected to. So far I only found the library linked below. Is the best I can get or should I use something else? Managed WiFi (http://www.codeplex.com/managedwifi)

这是利用 WMI的方法适用于Windows XP,但它是与Windows Vista不工作了。

The method that exploits WMI works for Windows XP but is it not working anymore with Windows Vista.

推荐答案

我决定使用的库。这导致相当容易的类工作提供了:

I resolved using the library. It resulted to be quite easy to work with the classes provided:

首先,我必须创建一个WlanClient对象

First I had to create a WlanClient object

wlan = new WlanClient();

然后我可以在PC连接到这个code中的SSID的列表:

And then I can get the list of the SSIDs the PC is connected to with this code:

Collection<String> connectedSsids = new Collection<string>();

        foreach (WlanClient.WlanInterface wlanInterface in wlan.Interfaces)
        {
            Wlan.Dot11Ssid ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid;
            connectedSsids.Add(new String(Encoding.ASCII.GetChars(ssid.SSID,0, (int)ssid.SSIDLength)));
        }

这篇关于获取无线网络,我在Windows Vista上连接到与C#.NET的SSID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆