There are few methods to check if computer is online (=connected) or offline (=disconnected). This one is really simple.
We need just one line of code and we will use WinInet unit. Whole function is here:
function Online: boolean;
begin
result := (InternetGetConnectedState(nil, 0))
end;