Sub GetIP As String
DeviceIP = ""
InitNetInfo
Try
DeviceIP = MyIP.GetMyWifiIP ' WiFi IP
Catch
End Try
If DeviceIP <> "" AND DeviceIP <> "127.0.0.1" Then ' WiFi must be on and connected because we have only checked for the WiFiIP
OnWiFi = True
Return DeviceIP
End If
If DeviceIP = "127.0.0.1" Then 'WiFi is apparently off, so next we'll try to get the non-WiFi IP
OnWiFi = False
End If
Try
DeviceIP = MyIP.GetMyIP ' Non-WiFi IP
OnWiFi = False
Catch
DeviceIP = ""
End Try
MyIP.Close
Return DeviceIP
End Sub
Sub InitNetInfo
Try
If MyIP.IsInitialized = False Then
MyIP.Initialize (1051,"")
End If
Catch ' Possibly left other app (free or pro) running
If MyIP.IsInitialized = False Then
MyIP.Initialize (1052,"")
End If
End Try
End Sub