Comment fermer une session FTP ? J'ai essayé les exemples d'arnaud bolet (ca marche pas :)
-----Message d'origine----- Bonjour.
regarde sur le site de Arnaud: http://memoaccess.free.fr/net.htm#IsConnected
-- @+ Raymond Access MVP http://access.seneque.free.fr/ http://access2003.free.fr/ http://users.skynet.be/mpfa/ pour débuter sur le forum
"Guillaume" a écrit dans le message de
news:3b1201c3e333$9f8c86d0$ Bonjour,
Y a t_il un moyen de détecter une connexion sur internet ? avec ou sans code VBA Cordialement.
.
Anor
Bonjour,
Guillaume : | Bonjour, | | Comment fermer une session FTP ? | J'ai essayé les exemples d'arnaud bolet | (ca marche pas :)
l'aPI ne fait pas la différence entre une connection réseau et connection internet. Essayer d'ouvrir une URL : si ouverture ok => connecté, sinon pas ok
par exemple :
Option Compare Database Option Explicit
Declare Function InternetOpen Lib "wininet.dll" _ Alias "InternetOpenA" _ (ByVal lpszAgent As String, _ ByVal dwAccessType As Long, _ ByVal lpszProxyName As String, _ ByVal lpszProxyBypass As String, _ ByVal dwFlags As Long) As Long
Declare Function InternetOpenUrl Lib "wininet.dll" _ Alias "InternetOpenUrlA" _ (ByVal hInet As Long, _ ByVal lpszUrl As String, _ ByVal lpszHeaders As String, _ ByVal dwHeadersLength As Long, _ ByVal dwFlags As Long, _ ByVal dwContext As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll" _ (ByVal hInet As Long) As Long
Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0 Const INTERNET_FLAG_RELOAD As Long = &H80000000 Const INTERNET_FLAG_KEEP_CONNECTION As Long = &H400000 Const INTERNET_FLAG_NO_CACHE_WRITE As Long = &H4000000
Function fOnLine() As Boolean
Dim hInet As Long Dim hUrl As Long Dim Flags As Long
If hInet Then Flags = INTERNET_FLAG_KEEP_CONNECTION Or _ INTERNET_FLAG_NO_CACHE_WRITE Or _ INTERNET_FLAG_RELOAD hUrl = InternetOpenUrl(hInet, "http://www.microsoft.com", vbNullString, 0&, Flags, 0&) If hUrl Then fOnLine = True Call InternetCloseHandle(hUrl) Else fOnLine = False End If End If Call InternetCloseHandle(hInet) End Function
-- à+ Arnaud ------------------------------------------------------------------- *Une question ?* La réponse est ici : http://users.skynet.be/mpfa/ *Pas de question ?* La réponse est là : http://memoaccess.free.fr /Réponses restantes souhaitées sur ce forum, merci/ -------------------------------------------------------------------
Bonjour,
Guillaume <anonymous@discussions.microsoft.com> :
| Bonjour,
|
| Comment fermer une session FTP ?
| J'ai essayé les exemples d'arnaud bolet
| (ca marche pas :)
l'aPI ne fait pas la différence entre une connection réseau et connection
internet.
Essayer d'ouvrir une URL : si ouverture ok => connecté,
sinon pas ok
par exemple :
Option Compare Database
Option Explicit
Declare Function InternetOpen Lib "wininet.dll" _
Alias "InternetOpenA" _
(ByVal lpszAgent As String, _
ByVal dwAccessType As Long, _
ByVal lpszProxyName As String, _
ByVal lpszProxyBypass As String, _
ByVal dwFlags As Long) As Long
Declare Function InternetOpenUrl Lib "wininet.dll" _
Alias "InternetOpenUrlA" _
(ByVal hInet As Long, _
ByVal lpszUrl As String, _
ByVal lpszHeaders As String, _
ByVal dwHeadersLength As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Long
Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0
Const INTERNET_FLAG_RELOAD As Long = &H80000000
Const INTERNET_FLAG_KEEP_CONNECTION As Long = &H400000
Const INTERNET_FLAG_NO_CACHE_WRITE As Long = &H4000000
Function fOnLine() As Boolean
Dim hInet As Long
Dim hUrl As Long
Dim Flags As Long
If hInet Then
Flags = INTERNET_FLAG_KEEP_CONNECTION Or _
INTERNET_FLAG_NO_CACHE_WRITE Or _
INTERNET_FLAG_RELOAD
hUrl = InternetOpenUrl(hInet, "http://www.microsoft.com", vbNullString, 0&, Flags, 0&)
If hUrl Then
fOnLine = True
Call InternetCloseHandle(hUrl)
Else
fOnLine = False
End If
End If
Call InternetCloseHandle(hInet)
End Function
--
à+
Arnaud
-------------------------------------------------------------------
*Une question ?* La réponse est ici : http://users.skynet.be/mpfa/
*Pas de question ?* La réponse est là : http://memoaccess.free.fr
/Réponses restantes souhaitées sur ce forum, merci/
-------------------------------------------------------------------
Guillaume : | Bonjour, | | Comment fermer une session FTP ? | J'ai essayé les exemples d'arnaud bolet | (ca marche pas :)
l'aPI ne fait pas la différence entre une connection réseau et connection internet. Essayer d'ouvrir une URL : si ouverture ok => connecté, sinon pas ok
par exemple :
Option Compare Database Option Explicit
Declare Function InternetOpen Lib "wininet.dll" _ Alias "InternetOpenA" _ (ByVal lpszAgent As String, _ ByVal dwAccessType As Long, _ ByVal lpszProxyName As String, _ ByVal lpszProxyBypass As String, _ ByVal dwFlags As Long) As Long
Declare Function InternetOpenUrl Lib "wininet.dll" _ Alias "InternetOpenUrlA" _ (ByVal hInet As Long, _ ByVal lpszUrl As String, _ ByVal lpszHeaders As String, _ ByVal dwHeadersLength As Long, _ ByVal dwFlags As Long, _ ByVal dwContext As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll" _ (ByVal hInet As Long) As Long
Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0 Const INTERNET_FLAG_RELOAD As Long = &H80000000 Const INTERNET_FLAG_KEEP_CONNECTION As Long = &H400000 Const INTERNET_FLAG_NO_CACHE_WRITE As Long = &H4000000
Function fOnLine() As Boolean
Dim hInet As Long Dim hUrl As Long Dim Flags As Long
If hInet Then Flags = INTERNET_FLAG_KEEP_CONNECTION Or _ INTERNET_FLAG_NO_CACHE_WRITE Or _ INTERNET_FLAG_RELOAD hUrl = InternetOpenUrl(hInet, "http://www.microsoft.com", vbNullString, 0&, Flags, 0&) If hUrl Then fOnLine = True Call InternetCloseHandle(hUrl) Else fOnLine = False End If End If Call InternetCloseHandle(hInet) End Function
-- à+ Arnaud ------------------------------------------------------------------- *Une question ?* La réponse est ici : http://users.skynet.be/mpfa/ *Pas de question ?* La réponse est là : http://memoaccess.free.fr /Réponses restantes souhaitées sur ce forum, merci/ -------------------------------------------------------------------