如何判断本机是否已连上了互连网?如果没有连上,则提示"未连上",
连上则进行下一步处理

解决方案 »

  1.   

    可让程序ping一个外部ip,如果有返回的数据包,就是连上网了,
    如果没有接受到返回的数据包,就提示“未连接”。帮你顶先
      

  2.   

    function CheckUrl(s:string):boolean;
    begin
     try
        Application.ProcessMessages;
        Sleep(70);
        IdHTTP1.Head(S);
        if pos('200 OK', IdHTTP1.Response.ResponseText)<> -1 then
          result:=True
        else
          result:=false;
      except
          result:=false;
      end;
    end;   if CheckUrl('http://www.163.com') then
    Showmessage('已连接') 
    Else
    Showmessage('未连上')