小弟初学DELPHI,想问个很简单的问题,如何检测自己的网络连接状况呢?我是用的ADSL拨号上网,不知道是线路的问题还是网络或者是猫的问题,经常掉线,而我有时候开着机器下载,自己坐在另一间房看书,掉了线我也不知道,白白浪费许多时间下载.所以我想自己写个程序来检测网络连接状况,一旦掉线了就会发声提醒我.请问一下这个程序如何写呢?只需要告诉我如何检测自己的网络状况就行了,谢谢大家.

解决方案 »

  1.   

    帮你顶....    我想是不是可以ping网上一个地址(www.163.com) 检查返回的数据。
      

  2.   

    Win32 Internet(WinInet) 函数
    InternetCheckConnection
    InternetQueryOption
      

  3.   

    http://community.csdn.net/Expert/topic/3702/3702004.xml?temp=.9800684
      

  4.   

    大富翁离线包里找到的,贴给你试试:
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      if GetSystemMetrics(SM_NETWORK) AND $01 = $01 then
        ShowMessage('Machine is attached to network') 
      else
        ShowMessage('Machine is not attached to network');
    end;