uses Wininet;

{$R *.dfm}

function NetWorkIsConnect(Url:string='http://www.microsoft.com/'): Boolean;
var
ConTypes : Integer;
begin
Result := false;
ConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY;
if InternetGetConnectedState(@ConTypes, 0) then //ConTypes := $01 + $02 + $04;
Result := True
else
if InternetCheckConnection(PWideChar(Url), 1, 0) then
Result := True;
end;

 

posted on 2011-11-26 08:54  东睿软件工作室  阅读(374)  评论(0编辑  收藏  举报