How to check an Internet connection
2007-06-16 12:59
423 查看
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
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
相关文章推荐
- [XAF] How to represent an enumeration property via a drop-down box with check boxes
- 互联网工作原理(19.How to Access the Internet via a Satellite Connection)
- How to check the MSOLAP Provider used in connection string
- How to Check RPC over HTTP Connection Status on Outlook Client
- How to Check if an Array Contains a Value in Java Efficiently?
- How To Install Speedtest-cli On a CentOS / RHEL / Scientific / Fedora Linux To Check Internet Speed
- How to Check if an Array Contains a Value in Java Efficiently?---reference
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How to Build an High Availability MQTT Cluster for the Internet of Things
- How to Build an High Availability MQTT Cluster for the Internet of Things
- 提交到app store遇到checksum validation failed和an ssl error has occurred and a secure connection to the se
- How to Make an HTTP Connection Using TCP/IP with RSocket
- JavaScript: How to detect that the Internet Connection is foffline
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How to Learn Programming Without an Internet?
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How To Share The Internet Connection Between Mac and PC
- How to Check if an Array Contains a Value in Java Efficiently?
- How to hide an entry in the Add/Remove Programs applet?