Hello,
This is the code
VB Code:
  1. Private Sub cmdgetstate_Click()
  2. Dim lres As Long
  3.  
  4. lres = InternetGetConnectedState(lret, 0&)
  5.  
  6. If (lret And INTERNET_CONNECTION_CONFIGURED) = INTERNET_CONNECTION_CONFIGURED Then
  7.   MsgBox ("This system has a valid internet connection ")
  8. End If
  9.  
  10. If (lret And INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN Then
  11.   MsgBox ("This system is connected to internet through LAN")
  12. End If
  13.  
  14. If (lret And INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM Then
  15.   MsgBox ("This system is connected to internet through modem")
  16. End If
  17.  
  18. If (lret And INTERNET_CONNECTION_OFFLINE) = INTERNET_CONNECTION_OFFLINE Then
  19.   MsgBox ("This system is presently offline")
  20. End If
  21.  
  22. If (lret And INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY Then
  23.   MsgBox ("This system is connected to internet through proxy")
  24. End If
  25.  
  26. If (lret And INTERNET_RAS_INSTALLED) = INTERNET_RAS_INSTALLED Then
  27.   MsgBox ("This system has RAS installed ")
  28. End If
  29.  
  30. End Sub

Message box is being displayed only for INTERNET_CONNECTION_LAN and INTERNET_RAS_INSTALLED.
How come the function detecting the valid internet connection says "NO" , but the function detecting connection through lan says "YES"?
This being the case , how do I check to see if a user of my program is connected to the internet?
Thank you.