LAN Web TCP Delphi

Title: How to tell if a user has an Internet connection.
Question: How do I tell if a user is currently connected to the internet?
Answer:
You can use the following code to determine if a connection to the internet is present:
function GetOnlineStatus : Boolean;
var ConTypes : Integer;
begin
ConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY;
if (InternetGetConnectedState(@ConTypes, 0) = False) then Result := False else Result := True;
end;
There is a bug in this, but I think its a bug in the InternetGetConnectedState API function ( it's in WinInet.dll ). This code can only tell if there has been an internet connection scence startup. If a PC hasn't been connect to the net, then it returns false. If it has, then it returns true, even if the PC has gone offline. You can see this kind of behavior in OutLook when you use outlook to establish a connection.