title: Checking for internet connection in runtime
body: <p>In which event or how can i check for internet connections while program is running? Scenario: program is running and suddenly internet connection goes off and a dialog opens "No internet access, changing connection string to central database". I tried this function, but im not sure in which event should i put so that it works all the time.</p>
  
  <pre><code>function TFK_Lib.CheckInternet: boolean;
  begin
    ConnectedState := INTERNET_CONNECTION_MODEM;
    Result := InternetGetConnectedState(@ConnectedState, 0);
  end;
  </code></pre>