All pastes #966447 Raw Edit

connectweb

public text v1 · immutable
·published 2008-04-01 19:16 UTC
rendered paste body
Attribute VB_Name = "ConnectWeb"
Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" ( _
                ByRef lpSFlags As Long, ByVal lpszConnectionName As String, _
                ByVal dwNameLen As Long, ByVal dwReserved As Long) As Long

Public Function IsConnected() As Boolean
' Cette fonction vrifie si une connexion rseau est active
Dim lgLen As Long, lgFlags As Long
Dim stNomConnexion As String
Dim blConnected As Boolean
lgLen = 256
stNomConnexion = Space$(lgLen)
blConnected = InternetGetConnectedStateEx(lgFlags, stNomConnexion, lgLen, 0&)
IsConnected = blConnected
End Function