zoukankan      html  css  js  c++  java
  • How to check an Internet connection

    Often in an App that works with Internet you need to know is user connected to Internet or not? I think below is most flexible sotution
    To make sure in this point you need to import InetIsOffline function from URL.DLL:

    function InetIsOffline(Flag: Integer): Boolean; stdcall; external 'URL.DLL';

    and then simply call this function in place you want to check connection status:

    if InetIsOffline(0) then
       ShowMessage('This computer is not connected to Internet!')
    else
       ShowMessage(You are connected to Internet!');

    This function return TRUE if the local system isn't connected to Internet, or FALSE if it's connected or no attempt has been yet made to connect.

    Notes:
    Variable Flag is ignored, so always use zero.
    This DLL is usual installed on most computers. It is always installed on Win98 or comes with Internet Explorer 4 or later, Office 97 etc.
    Read more on MSDN. Original: http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/InetIsOffline.htm
  • 相关阅读:
    linux echo 换行
    linux 脚本 逻辑关系的写法及区别
    linux vim ***
    跟我一起学Makefile
    linux awk
    linux grep命令 ***
    unbuntu 安装及服务器配置
    linux 静态库文件
    samba 配置
    linux tar
  • 原文地址:https://www.cnblogs.com/taobataoma/p/785627.html
Copyright © 2011-2022 走看看