I use the InternetGetConnectedState function, but when I turn off the Internet, it continues to return True me. This causes an error. How to be?

2 answers 2

The error was that the function returns true , because there is an active modem. The Internet_Connection_Modem parameter should not be passed to this function.

     function CheckInetLink(URL: string): byte; begin Result := CheckInetConnect; if URL <> '' then if Result <> 0 then if not CheckUrl(URL) then Result := 0; end; 

    If you do not pass the URL, then it will simply check the connection (but it happens that there is a connection, but there is no Internet), and if you pass the URL, it will check its availability (this is a more reliable option). It is better to send the URL for example on Google or Yandex.

    • Thanks, It works great, but I wanted to understand exactly the specified function. - Zhenek