Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
Set colItems = objWMIService.ExecQuery("Select * From MSNdis_80211_ReceivedSignalStrength")
For Each objItem in colItems
intStrength = objItem.NDIS80211ReceivedSignalStrength
If intStrength > -57 Then
strBars = "5 Bars"
ElseIf intStrength > -68 Then
strBars = "4 Bars"
ElseIf intStrength > -72 Then
strBars = "3 Bars"
ElseIf intStrength > -80 Then
strBars = "2 Bars"
ElseIf intStrength > -90 Then
strBars = "1 Bar"
Else
strBars = "Strength cannot be determined"
End If
Wscript.Echo objItem.InstanceName & " -- " & strBars
Next
Public Function RetrieveSignalStrength() As Double
ListBox2.Items.Clear()
Dim query As Management.ManagementObjectSearcher
Dim Qc As Management.ManagementObjectCollection
Dim Oq As Management.ObjectQuery
Dim Ms As Management.ManagementScope
Dim Co As Management.ConnectionOptions
Dim Mo As Management.ManagementObject
Dim signalStrength As Double
Try
Co = New Management.ConnectionOptions
Ms = New Management.ManagementScope("root\wmi")
Oq = New Management.ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength Where active=true")
query = New Management.ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
signalStrength = 0
For Each Mo In query.Get
signalStrength = Convert.ToDouble(Mo("Ndis80211ReceivedSignalStrength"))
Next
Catch exp As Exception
' Indicate no signal
signalStrength = -1
End Try
ListBox2.Items.Add(signalStrength)
Return Convert.ToDouble(signalStrength)
End Function
function Main()
local oWMI, objWMI, oBios, oData
oWmi := CreateObject( "wbemScripting.SwbemLocator" )
objWMI := oWmi:ConnectServer()
oBios := objWMI:ExecQuery( "Select * From MSNdis_80211_ReceivedSignalStrength" )
for each oData in oBios
MsgInfo( oData:Ndis80211ReceivedSignalStrength )
next
return nil
On Error Resume Next
dim count
strComputer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MSNdis_80211_ReceivedSignalStrength",,48)
For Each objItem in colItems
msgbox objItem.Ndis80211ReceivedSignalStrength
Next
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 97 guests