Checking for Internet Connection in VC++





5.00/5 (3 votes)
Code for checking the avilabiltiy of Internet connection.
Checking for Internet connection can be done using this code:
#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.