Can someone convert this to Delphi 2010? After not being able to find delphi code to return WiFi Signal Strength I found this basic code. Can someone convert this to Delphi?
'**************************************
' Name: WiFi Signal Strength
' Description:Returns the Wifi signal st
' rength in bars (1 to 5, 5 being good)
' By: Techni Rei Myoko
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=71872&lngWId=1'for details.'**************************************
Option Explicit
Public WiFiHardwareName As String, WiFiDecibals As Long
Dim objWMIService As Object, isSet As Boolean
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Public Enum ConnectedState
INTERNET_CONNECTION_MODEM = &H1
INTERNET_CONNECTION_LAN = &H2
INTERNET_CONNECTION_PROXY = &H4
INTERNET_CONNECTION_MODEM_BUSY = &H8
INTERNET_RAS_INSTALLED = &H10
INTERNET_CONNECTION_OFFLINE = &H20
INTERNET_CONNECTION_CONFIGURED = &H40
End Enum
Public Function WifiSignalStrength(Optional Computer As String = ".") As Long
On Error Resume Next
Dim colItems As Object, objItem As Object
WifiSignalStrength = IIf(isConnected, 5, 0)
If Not isSet Then
Set objWMIService = GetObject("winmgmts:\\" & Computer & "\root\wmi")
isSet = True
End If
Set colItems = objWMIService.ExecQuery("Select * From MSNdis_80211_ReceivedSignalStrength")
For Each objItem In colItems
WiFiDecibals = objItem.NDIS80211ReceivedSignalStrength
WiFiHardwareName = objItem.InstanceName
Select Case WiFiDecibals
Case 0: WiFiHardwareName = "Ethernet"
Case Is > -57: WifiSignalStrength = 5 ' -56 To 0
Case Is > -68: WifiSignalStrength = 4 '-67 To -57
Case Is > -72: WifiSignalStrength = 3 '-71 To -68
Case Is > -80: WifiSignalStrength = 2 '-79 To -72
Case Is > -90: WifiSignalStrength = 1 '-89 To -80
Case Else: WifiSignalStrength = 0
End Select
Next
End Function
'Connection
Public Function isConnected() As Boolean
Dim dwFlags As Long, retval As Long
retval = InternetGetConnectedState(dwFlags, 0&)
isConnected = retval = 1
End Function