Click here to Skip to main content
15,882,055 members
Articles / Programming Languages / Visual C++ 10.0
Tip/Trick

Checking for Internet Connection in VC++

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
29 Jul 2011CPOL 19.8K   7  
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)



Comments and Discussions

 
-- There are no messages in this forum --