1 頁 (共 1 頁)

如何檢驗是否連在網路上

發表於 : 2008年 11月 27日, 17:49
tim
使用 Wininet 中的 InternetGetConnectedState WinAPI 即可.
不要使用 InetIsOffline , 該狀態不即時不準確!!

代碼: 選擇全部

     
    uses Wininet .. 
    ... 
    procedure Tform1.Button3Click(Sender: TObject); 
    var 
      state: LONGWORD; 
    begin 
      if InternetGetConnectedState( @state, 0) then 
        showmessage('connected!') 
      else 
        showmessage('not connected!'); 
    end; 



請參考相關資料:
http://delphi.ktop.com.tw/topic.asp?topic_id=18940
http://www.25emuhome.com/column/learn/v ... c_five.htm
http://www.jane.com.tw/bbs/topic.asp?TO ... e=Internet