Tools Links Login

Running Dialup Internet Connections Using the IE Connection Dialog

This allows you to be able to setup programs that can connect to the net using the IE connection dialog box. If the 'Never Dial a Connection' option is selected, this code will not be able to connect. It is pretty straight forward to me, but if you need help just email me!

Original Author: Carroll Dearstone

Code

'-------------------

'Start Examples of Form Code

'-------------------

Private Sub cmdConnectPopUp_Click()

PopUpConnectDialog

End Sub

Private
Sub cmdConnectAndDial_Click
()

PopUpThenDialConnectDialog

End Sub


Private
Sub cmdDisconnect_Click
()

HangUpConnection

End Sub


Private
Sub Form_Load()


PopUpThenDialConnectDialog

End Sub


'-------------------

'End Examples of Form Code

'-------------------



'-------------------

'Start Module Code

'-------------------


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


Public
Const
INTERNET_AUTODIAL_FORCE_ONLINE
= 1

Public Const INTERNET_AUTODIAL_FORCE_UNATTENDED
= 2


Function
PopUpConnectDialog
()

On Error Resume Next

If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE,
0) Then

MsgBox "You're Connected!", vbOKOnly, "Your App Name"

End If

End Function


Function
PopUpThenDialConnectDialog
()

On Error Resume Next

If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then

MsgBox "You're Connected!", vbOKOnly, "Your App Name"

End If

End Function


Function
HangUpConnectio
n()

On Error Resume Next

If InternetAutodialHangup(0) Then

MsgBox "You're Disconnected!", vbOKOnly, "Your App Name"

End If

End Function

'-------------------

'End Module Code

'-------------------


Thanks,

Carroll Dearstone

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 101 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.