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.
function TFK_Lib.CheckInternet: boolean;
begin
ConnectedState := INTERNET_CONNECTION_MODEM;
Result := InternetGetConnectedState(@ConnectedState, 0);
end;
You can do a practical test and ping google.com. If I understood your question correctly I thinks its not a bad option. Code example: