Detecting WAN radio power off

c++, wifi, winapi

Like most laptops, mine (a Dell Inspiron 1420) has a small button which can be used to turn the wifi card on and off. Is there any way to detect that the radio has been turned off in a Win32 C program or service? I'm looking for a better way than to get the list of the visible access points, something that only depends on the state of that button.

Update – the solution is monitoring hardware events with a Windows service. You can get some code that does that here.

Update 2 – after more research it seems that the hardware events are sent for the Bluetooth device that is disabled when you hit the radio off switch. So, hardware monitoring works only for laptops that have both internal Bluetooth and wifi (probably on the same card). I never found a definite solution to this problem and have to live with the Bluetooth-based heuristic.

Best Solution

I think it just disables the card in Windows - would this be different than detecting if there's a WLAN card in the the device manager that's currently disabled?

I'm a VB programmer, so I can't help with the specifics, but just wanted to give somewhere to start.