Results 1 to 3 of 3

Thread: Connection Status

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    2
    Is there a good way to detect if a PC is connected via phone or Netwrok without using WININET.DLL?

  2. #2
    New Member
    Join Date
    Aug 2000
    Location
    In
    Posts
    5

    Thumbs up Through VB .....

    Write this code in a VB Project MODULE.bas

    Option Explicit
    Public Declare Function InternetGetConnectedState _
    Lib "wininet.dll" (ByRef lpSFlags As Long, _
    ByVal dwReserved As Long) As Long

    Public Const INTERNET_CONNECTION_LAN As Long = &H2
    Public Const INTERNET_CONNECTION_MODEM As Long = &H1

    Public Function Online() As Boolean
    Dim SFlags As Long
    '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(INTERNET_CONNECTION_LAN, 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(INTERNET_CONNECTION_MODEM, 0)
    'True if the Sflags has a modem connection
    ViaModem = SFlags And INTERNET_CONNECTION_MODEM
    End Function


    NOW WRITE THE FOLLOWING CODE IN FORM HAVING 2 TEXT BOXES & A COMMAND BUTTON

    Private Sub Command1_Click()
    Text1 = ViaLAN()
    Text2 = ViaModem()
    Text3 = Online()
    End Sub

    But there is a bug in this program hope you'll be able to resolve it & get back to me. Atleast I've got you started with it.
    BYE

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    2
    Thanks for the code sample. However, I'm trying to determine connection state using something other than WININET.DLL


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