Détection de l'état de la connexion internet

GhayeJ Messages postés 13 Date d'inscription samedi 23 novembre 2002 Statut Membre Dernière intervention 12 août 2003 - 24 nov. 2002 à 19:14
cs_CanisLupus Messages postés 3757 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 13 mars 2006 - 3 févr. 2004 à 16:06
Ben voila, j'expose le problème. Comment peut-on faire pour savoir si la connexion internet est active ? c pas possible avec winapi ?
Merci de me répondre assez rapidement.

4 réponses

BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 12
25 nov. 2002 à 09:08
utilise un winsock:
Winsock1.LocalIP="127.0.0.1" si tu n'est pas connecté
0
PierrotVB Messages postés 58 Date d'inscription vendredi 12 juillet 2002 Statut Membre Dernière intervention 20 août 2004
25 nov. 2002 à 13:45
Salut

Private Const INTERNET_CONNECTION_CONFIGURED = &H40
Private Const INTERNET_CONNECTION_LAN = &H2
Private Const INTERNET_CONNECTION_MODEM = &H1
Private Const INTERNET_CONNECTION_OFFLINE = &H20
Private Const INTERNET_CONNECTION_PROXY = &H4
Private Const INTERNET_RAS_INSTALLED = &H10
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Ret As Long
Me.AutoRedraw = True
'retrieve the connection status
InternetGetConnectedState Ret, 0&
'show the result
If (Ret And INTERNET_CONNECTION_CONFIGURED) = INTERNET_CONNECTION_CONFIGURED Then Me.Print "Local system has a valid connection to the Internet, but it may or may not be currently connected."
If (Ret And INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN Then Me.Print "Local system uses a local area network to connect to the Internet."
If (Ret And INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM Then Me.Print "Local system uses a modem to connect to the Internet."
If (Ret And INTERNET_CONNECTION_OFFLINE) = INTERNET_CONNECTION_OFFLINE Then Me.Print "Local system is in offline mode."
If (Ret And INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY Then Me.Print "Local system uses a proxy server to connect to the Internet."
If (Ret And INTERNET_RAS_INSTALLED) = INTERNET_RAS_INSTALLED Then Me.Print "Local system has RAS installed."
End Sub
0
Captain Idiot Messages postés 20 Date d'inscription dimanche 19 août 2001 Statut Membre Dernière intervention 7 juin 2012
27 nov. 2002 à 17:42
Utilise la fonction IsDestinationReachable de l'A.P.I.

plus d'info sur http://www.mvps.org/vbnet/index.html?code/network/isdestinationreachable.htm
0
cs_CanisLupus Messages postés 3757 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 13 mars 2006 20
3 févr. 2004 à 16:06
Désolé, tous ces systèmes ne fonctionnent pas dans ma boite.

CanisLupus
0
Rejoignez-nous