开发者

Check if wireless adapter is on / exist in C#

I'm using ManagedWifi in my C# application. The application will take control and connect to a designated SSID. Right now I'm trying to handle all possible errors, especially this. At the moment the program can't tell if a wireles开发者_如何学Pythons adapter is turned on / or even exists at all. The ManagedWifi code goes on as per normal, and did not throw any exception at all. Any help would be appreciated, thanks.


The WLAN API is your friend. In particular, see the example in the WlanQueryInterface documentation. Note that many laptops have an on/off switch for the wifi adapter, and in many of these the adapter will not be visible to windows at all when this switch is off.

I know that WMI can also be used to do some WIFI stuff, but I'm not sure if it can enumerate adapters and discover their properties the way that the WLAN api can.

Edited to add: Be aware of the existence of the Windows 7 Virtual Adapter, it tripped me up writing my wifi control application when I first encountered it.


WMI is probably the best way to query the information you're looking for

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜