65.9K
CodeProject is changing. Read more.
Home

Checking for Internet Connection in VC++

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Jul 29, 2011

CPOL
viewsIcon

20110

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.