leestar54

前言

一般正常情况下都会用windows自带的wifi连接,但是为了给用户更好的体验,或者有时候需要检测wifi状态,还是需要集成到项目中态。

原理

1、微软自带Native Wifi API,不过是用C++的。

2、已有大神用c#封装了Native Wifi API,所以c#开发基于该封装,地址:http://managedwifi.codeplex.com/

3、连接前需要配置WLAN profile,如果连接失败,则要删除该配置。

4、也可以使用cmd命令

删除配置文件
在命令提示符下,键入:
netsh wlan delete profile name="ProfileName"
显示电脑上的所有无线配置文件
在命令提示符下,键入:
netsh wlan show profiles
显示安全密钥
在命令提示符下,键入:
netsh wlan show profile name="ProfileName" key=clear
停止自动连接到范围外的网络
在命令提示符下,键入:
netsh wlan set profileparameter name="ProfileName" connectionmode=manual(自动填auto)

实现

1、wifi列表tooltip显示详细信息

2、按照信号强度排序

3、连接状态显示

具体代码使用在项目里注释都非常清楚了

链接:http://pan.baidu.com/s/1eQlhH9S 密码:2alj

 

参考:

WLAN_profile Schema Elements https://msdn.microsoft.com/zh-cn/library/ms706965

Native Wifi https://msdn.microsoft.com/en-us/library/ms706556(v=vs.85).aspx

Wireless Profile Samples https://msdn.microsoft.com/zh-cn/library/aa369853

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-06-14
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案