WLAN State

mamuen

Member
Licensed User
Hi,

this is my way to detect the Wlan-state. It works only on devices!
Tested for WM5.0 and WM6.5
.
.
.
reg.New1
reg.RootKey(reg.rtLocalMachine)
.
.
x=getWlanState

If x = 0 Then
Msgbox(" no WlanCard!",cMsgboxOK,cMsgboxAsterisk)
End If

If x = 1 Then
Msgbox(" Wlan is disabled!",cMsgboxOK,cMsgboxAsterisk)
End If

If x = 19 Then
Msgbox(" Wlan is OK!",cMsgboxOK,cMsgboxAsterisk)
End If
.
.
.

Sub getWlanState
'HKEY_LOCAL_MACHINE\System\State\Hardware\Wifi (0 not present, 1 disabled, 19 enabled)
wlan=0
If cPPC Then
regnames() = reg.GetValueNames("System\State\Hardware\")
For i = 0 To ArrayLen(regnames())-1 'Show all values found
If regnames(i)="Wifi" Then
wlan = reg.GetValue("System\State\Hardware\", "Wifi")
End If
Next
End If
return wlan
End Sub
 

agraham

Expert
Licensed User
Longtime User
From Googling around

> 0 - powered off
> 1 or 5 - ready
> 11 or 15 - connecting
> 19 or 23 - connected

There was a suggestion that the offset of 4 might indicate ActiveSync is connected (or then again it might not!).

Also you should be able to get the following system state notifications from my SystemState library.

WiFiStateConnected
WiFiStateConnecting
WiFiStateHardwarePresent
WiFiStateNetworksAvailable
WiFiStatePowerOn
 
Top