Results 1 to 8 of 8

Thread: connection

  1. #1

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    I've looked at several examples of how to detect if there is an internet connection present and how to connect via dial-up. But they all have their problems...what i need is to detect if a connection exists (preferable not using winsock) and if there is no connection then bring up the connect dialog...The examples that i've seen ask for the connection name, but i need to do this with out asking the connection name...just bring up the "connect to" dialog box.

    Thanx,
    D!m
    Dim

  2. #2
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    I'm sure there is a better way but you could run the dos command route print and see if 0.0.0.0 0.0.0.0 goes someplace.
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  3. #3

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    nm about the detecting part, i can always use good ol registry for that. But how about bringing up the connect box? Anyone?
    Dim

  4. #4
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    I had this in my notes from a week ago
    I never used it
    ---------------------
    FORCE CONNECTION
    ------------------------



    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&)
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  5. #5

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    no go, doesn't produce any errors and doesn't seem to do anything. Any ideas?
    Dim

  6. #6
    Guest
    This is about the same code. But it's coming from me, so maybe it will work ;].

    Code:
    Private Declare Function InternetAutodial Lib "wininet.dll" _
    (ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
    
    Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
    Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
    
    Private Declare Function InternetAutodialHangup Lib "wininet.dll" _
    (ByVal dwReserved As Long) As Long
    
    Private Sub Command1_Click()
    
    'To prompt the user to connect to the Net
    
    If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0) Then
    	MsgBox "You're Connected!", vbInformation
    End If
    
    'To automatically start dialling
    
    If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
    	MsgBox "You're Connected!", vbInformation
    End If
    
    'To disconnect an automatically dialled connection
    
    If InternetAutodialHangup(0) Then
       MsgBox "You're Disconnected!", vbInformation
    End If
    End Sub

  7. #7

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    It does seem to work...but i think i'm missing something here cause it just seems to check if there is a connection. It pops up 3 msgboxes "You Are Connected" "You Are connected" "You are disconnected"
    I did go offline to test it, but same events occur.
    Any ideas Matthew?
    Dim

  8. #8
    Guest
    I do have a code that'll connect you, but only if you know the connections name.

    Code:
    'Start an internet connection only showing the dialog
    Dim X
    'connection_name=ISP (Ex: Netzero, Freeinternet)
    X = Shell("rundll32.exe rnaui.dll,RnaDial " _
    & "connection_name", 1)
    
    'Start an internet connection and click connect
    Dim X
    'connection_name=ISP (Ex: Netzero, Freeinternet)
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "connection_name", 1)
    DoEvents
    'You can type in your password before the { below.
    SendKeys "{enter}", True
    DoEvents

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