来自:j_shen2000, 时间:2001-11-05 16:54:00, ID:708294
--------------------------------------------------------------------
如果你事先检索一下论坛,就不用花冤枉分了,这个问题在论坛上讨论过N次了。
uses WinInet;
procedure TForm1.Button1Click(Sender: TObject);
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;
begin
if GetOnlineStatus then
ShowMessage(' Connected')
else ShowMessage(' not Connected');
end;
再加个定时器就可以了。