Gold mine of Visual C++ tricks!
Archive for May 9, 2008
How to check whether internet connection is available.
41471 days
by Jijo Raj
in Uncategorized
![]()
I often notice that my anti-virus starts automatic update when internet connection is available. How does these applications detect internet connection?
![]()
You can use the api – InetIsOffline(). If internet connection is not available, it will return true else false. See the sample code snippet below.
#include "intshcut.h"
...
// Check whether internet connection is enabled.
if( !InetIsOffline( 0 ))
{
// Internet connection is available.
// Do automatic updates.
}
![]()
Don’t forget to add library – url.lib to your project settings.
![]()
Targeted Audience – Beginners.