Wednesday, August 24, 2005

Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" Alias _
"InternetGetConnectedStateExA" (lpdwFlags As Long , lpszConnectionName As Long , _
dwNameLen As Long , ByVal dwReserved As Long ) As Long

Function IsConnected() As Boolean
Dim lNameLen As Long
Dim lRetVal As Long
Dim lConnectionFlags As Long
Dim LPTR As Long
Dim lNameLenPtr As Long
Dim sConnectionName As String
sConnectionName = Space$(256)
lNameLen = 256
LPTR = StrPtr(sConnectionName)
lNameLenPtr = VarPtr(lNameLen)
lRetVal = InternetGetConnectedStateEx(lConnectionFlags, ByVal LPTR, ByVal lNameLen, 0&)
IsConnected = (lRetVal <> 0)
End Function

'also, info is in the registry
HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ RemoteAccess \ Remote Connection Is non zero.

0 Comments:

Post a Comment

<< Home