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

相关文章:

  • 2021-09-28
  • 2021-06-06
  • 2021-12-28
  • 2021-06-10
  • 2021-12-04
  • 2021-09-10
  • 2021-04-02
猜你喜欢
  • 2021-11-18
  • 2021-07-09
  • 2021-09-11
  • 2021-08-29
  • 2022-12-23
  • 2022-02-22
  • 2021-12-02
相关资源
相似解决方案