+ Reply to Thread
Results 1 to 3 of 3

checking for a connection to the web

  1. #1
    john.9.williams@bt.com
    Guest

    checking for a connection to the web

    Hi,

    I have a program that opens up a file on a server, the user will have
    to be online for this to happen, is there any code i can you to check
    weather the user has a connection.

    regards

    johny


  2. #2
    Tom Ogilvy
    Guest

    Re: checking for a connection to the web

    See Randy Birch's site/pages at www.mvps.org

    --
    Regards,
    Tom Ogilvy

    <john.9.williams@bt.com> wrote in message
    news:1106609393.112339.34470@c13g2000cwb.googlegroups.com...
    > Hi,
    >
    > I have a program that opens up a file on a server, the user will have
    > to be online for this to happen, is there any code i can you to check
    > weather the user has a connection.
    >
    > regards
    >
    > johny
    >




  3. #3
    Robin Hammond
    Guest

    Re: checking for a connection to the web

    Here's a simple version that might help.

    Option Explicit
    Option Private Module

    Private Declare Function InternetGetConnectedState Lib "wininet" _
    (ByRef dwFlags As Long, _
    ByVal dwReserved As Long) As Long

    Private Declare Function InternetCheckConnection Lib "wininet.dll" _
    Alias "InternetCheckConnectionA" (ByVal sUrl As String, _
    ByVal lFlags As Long, ByVal lReserved As Long) As Long

    Public Function IsNetConnected() As Boolean
    Dim lReturn As Long

    'you might want to put a get out clause in here that returns true
    'if the test is taking place behind a proxy server, which sometimes doesn't
    work
    'e.g. this checks a registry setting for an option to disable the function
    'you can omit the next 4 lines if this is beyond your needs
    If CBool(GetSetting("ProgName", "Settings", "DisableNetDetect", "FALSE"))
    Then

    IsNetConnected = True
    Exit Function

    End If

    IsNetConnected = InternetGetConnectedState(lReturn, 0)

    If IsNetConnected = False Then _
    IsNetConnected = InternetCheckConnection("http://www.yahoo.com", 1, 0)

    If IsNetConnected = False Then _
    MsgBox "You do not appear to have an active internet connection at this
    time" _
    & vbcrlf & "Please connect to the internet then retry this command",
    _
    vbOKOnly + vbInformation

    End Function

    Robin Hammond
    www.enhanceddatasystems.com

    <john.9.williams@bt.com> wrote in message
    news:1106609393.112339.34470@c13g2000cwb.googlegroups.com...
    > Hi,
    >
    > I have a program that opens up a file on a server, the user will have
    > to be online for this to happen, is there any code i can you to check
    > weather the user has a connection.
    >
    > regards
    >
    > johny
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1