BOOLIsconnect; DWORD DW; Isconnect=:: Isnetworkalive (&DW);if(isconnect) cout<<"isnetworkalive Connection"<<Endl; Elsecout<<"isnetworkalive Not Connected"<<Endl; cout<<"---------------------------------"<<Endl; //DW and DW2 identification, you can determine how the computer is connected to the network. Such as: agent, dialing, etc.DWORD dw2; BOOLret = InternetGetConnectedState (&DW2,0); if(ret) cout<<"InternetGetConnectedState Connection"<<Endl; Elsecout<<"InternetGetConnectedState Not Connected"<<Endl; cout<<"**********************************"<<Endl; //Flag_icc_force_connection: The API needs to be ping for a period of time (1-2 minutes) when the network connection address is not linked BOOLbconnected = Internetcheckconnection (_t ("http://www.baidu.com"), Flag_icc_force_connection,0);if(bconnected) cout<<"internetcheckconnection Connection"<<Endl; Elsecout<<"Internetcheckconnection Not Connected"<<Endl; cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
VC Network connection Judgment API