I am using the following declarations:

Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
Private Declare Function InternetAutodialHangup Lib "wininet.dll" (ByVal dwReserved As Long) As Long
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long

The current computer is connected to internet via LAN.
InternetGetConnectedState(0&, 0&) will then return '1'

If I unplug the RJ-45,
InternetGetConnectedState(0&, 0&) will still return '1'

If I let the RJ-45 unplugged and reboot the machine,
InternetGetConnectedState(0&, 0&) will then correctly return '0'

Read the topic, that's what I need. Is there a more efficient way than the one I'm trying to use?

Thanks for any feedback.

(I know that many threads were written about internet connectivity, but they just seem to have lost me)