Checking for Internet connection 
Author Message
 Checking for Internet connection

Is there any good way to check if a connection to the Internet is available?
I mean, so you don't try to connect to the Internet and the user has to face
the dial-up dialog window...?

--
Mvh, Erik


Homepage: http://www.*-*-*.com/ ://surf.to/partybilder



Mon, 26 Jan 2004 01:50:08 GMT  
 Checking for Internet connection
Not my code - but (if you have IE 4+) probably what you need.

Private Declare Function InternetGetConnectedState Lib "wininet.dll"
(lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal
dwFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetAutodialHangup Lib "wininet.dll"
(dwReserved As Long) As Boolean
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, _
                      ByVal cURL As String, _
                      ByVal cFilename As String, _
                      ByVal dwReserved As Long, _
                      ByVal lpfnCB As Long) As Long

Public Const DialUpConnection = 1
Public Const LocalAreaNetwork = 2
Public Const ProxyServer = 4
Public Const DialUpBusy = 8

Function Connection(Optional ByRef ConectionType As Variant) As
Boolean
    Dim Flags As Long
    If InternetGetConnectedState(Flags, 0&) Then Connection = True
End Function

Public Function DialUp()
    DialUp = InternetAutodial(0&, 0&)
End Function

Public Function Disconnect() As Boolean
    Disconnect = InternetAutodialHangup(0&)
End Function

Public Function Download(URL As String, File As String) As Long
    Download = URLDownloadToFile(ByVal 0, URL, File, 0, ByVal 0)
End Function

On Wed, 8 Aug 2001 19:50:08 +0200, "Erik ?kerlund"

Quote:

>Is there any good way to check if a connection to the Internet is available?
>I mean, so you don't try to connect to the Internet and the user has to face
>the dial-up dialog window...?

>--
>Mvh, Erik


>Homepage: http://come.to/meracl or http://surf.to/partybilder



Mon, 26 Jan 2004 03:28:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Advanced: CHECK for Internet Connection

2. Checking an Internet Connection

3. Check for internet connection

4. Checking an Internet Connection

5. checking for internet connection in NT

6. How to check for internet connection?

7. Check for internet connection

8. Advanced: CHECK for Internet Connection

9. Checking for Internet Connection

10. Check if internet connection is up.....

11. Check for Internet Connection

12. checking internet connection from .net

 

 
Powered by phpBB® Forum Software