Results 1 to 3 of 3

Thread: Internet Connection

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    13
    How can I make sure if a person is connected to the Internet?
    N.M.

  2. #2
    Lively Member
    Join Date
    Oct 2000
    Location
    Chicago
    Posts
    97

    Can you be more specific......

    Can you be more specific....
    Not able to understand your question.

    Regards
    Anil

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Here it is:

    Code:
    '[begin of code]
    'Author: Hutchie
    'Origin: http://www.vb-world.net/tips/tip467.html
    'Purpose: Check if there's an active internet connection
    'Version: VB5+
    
    Option Explicit
    
    Private Declare Function InternetGetConnectedState _
    Lib "wininet.dll" (ByRef lpSFlags As Long, _
    ByVal dwReserved As Long) As Long
    
    Private Const INTERNET_CONNECTION_LAN As Long = &H2
    Private Const INTERNET_CONNECTION_MODEM As Long = &H1
    
    Public Function Online() As Boolean
        'If you are online it will return True, otherwise False
        Online = InternetGetConnectedState(0&, 0&)
    End Function
    
    Public Function ViaLAN() As Boolean
    
    Dim SFlags As Long
    'return the flags associated with the connection
    Call InternetGetConnectedState(SFlags, 0&)
    
    'True if the Sflags has a LAN connection
    ViaLAN = SFlags And INTERNET_CONNECTION_LAN
    
    End Function
    Public Function ViaModem() As Boolean
    
    Dim SFlags As Long
    'return the flags associated with the connection
    Call InternetGetConnectedState(SFlags, 0&)
    
    'True if the Sflags has a modem connection
    ViaModem = SFlags And INTERNET_CONNECTION_MODEM
    
    End Function
    
    '[end of code]
    Just run:
    Code:
    MsgBox Online 'If you want to check if somebody is online
    MsgBox ViaModem 'To see if the person is using a modem
    MsgBox ViaLan 'To see if the person is connected via a LAN
    have fun mate
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

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



Click Here to Expand Forum to Full Width