uses
WinInet;
{...}
function IsConnectedToInternet: Boolean;
var
dwConnectionTypes: DWORD;
begin
dwConnectionTypes :=
INTERNET_CONNECTION_MODEM +
INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
Result := InternetGetConnectedState(@dwConnectionTypes, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsConnectedToInternet then
ShowMessage('Connected.')
else
ShowMessage('Not Connected.')
end;