Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
3.22/5 (3 votes)
yes I know! there is a lot of the same question here in www.codeproject.com. But I need a standard API or something to detect the connectivity.

Posted

You can use InternetGetConnectedState() by including wininet.h and using the following snippet:

<br />#pragma comment(lib,"wininet.lib")<br /> <br />if (InternetGetConnectedState(INTERNET_CONNECTION_LAN | INTERNET_CONNECTION_MODEM,0) == FALSE)<br />{<br />    // Not connected!<br />}<br />else<br />{<br />   // Connected!<br />}<br />


Cheers! :)
 
Share this answer
 
See here.

 
Share this answer
 
Check out the IsNetworkAlive API

 
Share this answer
 
 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900