如何使用C#获取Win7的SSID和RSSI
我对Win7和WMI很陌生。请告诉我在哪里可以看到 WiFi 的活动接入点以及如何获取每个接入点的 ssid/rssi。
我有使用:
ManagementClass mc = new ManagementClass("root\\WMI", "MSNdis_80211_ServiceSetIdentifier", null);
ManagementObjectSearcher searcher1 = new ManagementObjectSearcher(@"root\wmi","SELECT * FROM MSNdis_80211_BSSIList");
但我得到了 0 个结果。这个类支持Win7吗?有人可以帮忙吗?
I am very new to Win7 and WMI. Please advice me where to see for active access point from WiFi and how to get ssid/rssi for each access point.
I have use:
ManagementClass mc = new ManagementClass("root\\WMI", "MSNdis_80211_ServiceSetIdentifier", null);
ManagementObjectSearcher searcher1 = new ManagementObjectSearcher(@"root\wmi","SELECT * FROM MSNdis_80211_BSSIList");
but I got 0 results. Is this class support Win7? Anybody can help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题,我需要获取当前连接的 Wifi 网络的 SSID,但由于其复杂性,我不想为 API 创建包装器,所以我想为什么不使用 netsh
那么你可以从 proc.StandardOutput 检索输出。读到结束();
从字符串中解析出您想要的内容:
解析字符串比为 API 编写包装器容易得多
希望这有帮助
I had a similar problem where I needed to get the SSID of the currently connected Wifi network but didnt feel like creating a wrapper for the API due to its complexity so figured why not use netsh
then you can just retrieve the output from proc.StandardOutput.ReadToEnd();
parse out what you want from the string:
Much easier to parse a string than to write a wrapper for the API
Hope this helps
除了 WMI,您还可以使用托管 Wifi API。
检查这个问题
获取我在 Windows Vista 上使用 C# .Net 连接到的无线网络的 SSID
有时我使用 delphi-prism 编写了一个示例,与 C# 非常相似。
http://theroadtodelphi.wordpress.com /2009/09/30/使用-delphi-prism检测-wifi-网络/
Instead of WMI you can use the Managed Wifi API.
Check this question
Get SSID of the wireless network I am connected to with C# .Net on Windows Vista
Some time a go i wrote an example using delphi-prism, is very similar to C#.
http://theroadtodelphi.wordpress.com/2009/09/30/detecting-wifi-networks-using-delphi-prism/