Abfragen, ob eine Internet-Verbindung aktiv ist
-
Hallo!
Wie kann ich abfragen, ob eine Internet-Verbindung aktiv ist?Vielen Dank schon mal
Hansi
-
aus MSDN:
BOOL InternetGetConnectedState( OUT LPDWORD lpdwFlags, IN DWORD dwReserved );Retrieves the connected state of the local system.
Returns TRUE if there is an Internet connection, FALSE otherwise.
lpdwFlags
Address of a double-word variable where the connection description should be returned.
Can be a combination of the following values:
INTERNET_CONNECTION_MODEM Local system uses a modem to connect to the Internet.
INTERNET_CONNECTION_LAN Local system uses a local area network to connect to the Internet.
INTERNET_CONNECTION_PROXY Local system uses a proxy server to connect to the Internet.
INTERNET_CONNECTION_MODEM_BUSY Local system's modem is busy with a non-Internet connection.dwReserved
Reserved. Must be set to zero.
-
Genau das gleiche Problem hatte ich auch. Hier meine Lösung.
#include "Wininet.h" ... #pragma comment(lib,"wininet") ... bool CSetTime2Dlg::CheckForConnection() { BOOL isOnline = false; if (InternetCheckConnection("http://www.google.de",FLAG_ICC_FORCE_CONNECTION,0)) { isOnline = true; } return(isOnline); }