Internet DialUp

April 9, 2008

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