uses Winapi.WinSock; function CheckInternetConnection(AHost: PAnsiChar): Boolean; var PHE: PHostEnt; GInitData: TWSAData; begin WSAStartup($101, GInitData); PHE := GetHostByName(AHost); WSACleanup; Result := (PHE <> nil); end;
Kullanımı
procedure TfrmMain.btnInternetControlClick(Sender: TObject); begin if CheckInternetConnection('www.google.com.tr') then ShowMessage('Bağlı') else ShowMessage('Bağlı Değil'); end;