Internet connection
-
progman wrote: I want to verify internet connection from my application in VC++. (Is it or not ?) Use a combination of InternetGetConnectedState and InternetCheckConnection Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Hi Progman! Try this small function: long MyView::IsConnected() { unsigned long ulConnectionFlags = 1; return InternetGetConnectedState(&ulConnectionFlags ,0); } To be sure you can add an attempt to open a site but I don’t think it is necessary. You must add the #include "WININET.H" line and WININET.lib to your project.
-
If using a modem use: RasEnumConnections(..) fn and check for to see if the number of connection is > 0. If checking to see if LAN is present then Ping a url. I avoid InternetGetConnectedState(..) because it is not dynamic. ie Pull the LAN connection out of the wall and your icon on you computer shows it is disconnected but the InternetGetConnectedState(..)fn won't track it! Art