Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/WMI/WMI Wireless LAN Signal Strength
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/WMI/WMI Wireless LAN Signal Strength
This example is the version from Tue, 22th Jun 2015.
Project "WMI Wireless LAN Signal Strength.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() // required for Windows 8.1 call WindowsWMIMBS.InitSecurity(false) End EventHandler
End Class
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() update End EventHandler
End Control
Control tName Inherits Label
ControlInstance tName Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control tValue Inherits Label
ControlInstance tValue Inherits Label
End Control
Control tBars Inherits Label
ControlInstance tBars Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
EventHandler Sub Open() w=new WireLessNetworkSignalStrength update End EventHandler
Sub update() w.update tValue.text=str(w.value) tName.text=w.Name tBars.text=Str(w.Bars) End Sub
Property w As WireLessNetworkSignalStrength
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class WireLessNetworkSignalStrength
Function Bars() As integer if valid=false then Return 0 elseif value=0 then Return 0 elseIf value > -57 Then Return 5 ElseIf value > -68 Then Return 4 ElseIf value > -72 Then Return 3 ElseIf value > -80 Then Return 2 ElseIf value > -90 Then Return 1 Else Return 0 ' unknown End If End Function
Sub Constructor() if TargetWin32 then w=new WindowsWMIMBS if w.ConnectServer("root\wmi") then ' connected else w=nil end if end if update End Sub
Sub update() name="" value=0 if w<>Nil then if w.query("WQL","SELECT * FROM MSNdis_80211_ReceivedSignalStrength where active=true") then if w.NextItem then name=w.GetPropertyString("InstanceName") value=w.GetPropertyInteger("Ndis80211ReceivedSignalStrength") valid=true end if end if end if End Sub
Property Name As String
Property Valid As boolean
Property Value As Integer
Property Private w As windowsWMIMBS
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.




Links
MBS Xojo Plugins