uses WinInet;

procedure TForm1.Button1Click (Sender: TObject);
begin
  if InternetGetConnectedState (nil ,0) then ShowMessage ('connected');
end ;