Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VC10.0

Checking for Internet Connection in VC++

5.00/5 (3 votes)
29 Jul 2011CPOL 20.1K  
Code for checking the avilabiltiy of Internet connection.

Checking for Internet connection can be done using this code:


C++
#include <wininet.h>
#pragma comment(lib,"Wininet.lib")
bool bConnect=InternetCheckConnection(L"http://www.google.com",
              FLAG_ICC_FORCE_CONNECTION ,0);

A return value of true means Internet connection is available.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)