Results 1 to 6 of 6

Thread: Internet Connections

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Two Questions:

    How do I detect if the user is connected to the internet?

    If not, how do I launch the default dial-up connection?
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Wink Checking internet connection

    Code:
    'in a module
    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
        '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
    
    
    'to check if online, text1 will be true if online
    Text1 = Online()
    
    'This was a demo project from vb world.
    '  It had some problems in the module
    ' that I fixed up.

  3. #3

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Thanks, now I just need to know how to connect if there isn't already an active connection.
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  4. #4
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Also a tip, Not sure if its what your looking for though

    http://www.vbsquare.com/tips/tip168.html

    try this, its also a tip, Im not sure if its what you want though.

  5. #5

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    That is EXTREMELY close to what I want, the only problem is that it has to have the name of the connection, ie Mine is Olemac, not Freeserve.

    Is there any way to detect the name or some alternate way to connect?
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  6. #6

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Nevermind, I searched through some forum postings for a while for "connect internet" and found one that had this code in it:
    Code:
    Const Internet_Autodial_Force_Unattended As Long = 2 
    
    Public Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As 
    Long, ByVal dwReserved As Long) As Long 
    Public Declare Function InternetAutodialHangup Lib "wininet.dll" (ByVal 
    dwReserved As Long) As Long 
    
    
    'Code: 
    Dim lResult As Long 
    lResult = InternetAutodial(Internet_Autodial_Force_Unattended, 0&
    Thanks for your help regardless.
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

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