By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Auto-stop DUN via VB.Net?

P: n/a
Here's a good one for the gurus out there.

I'm building a custom application that will query a web-service to get
data. The users are broken into two groups. Group 1 is the in-office
staff that are connected to the network. Group 2 is the remote staff
that must connect via dial-up connection to the Internet to use the
web-service.

The user (a.k.a. boss) would like the application to automatically
close the dial-up connection if there hasn't been any activity for 10
minutes. Anyone like to share a way to programmatically launch a
dial-up connection and then close it from within my application? Even
pointing me to KB articles would be good.

Mar 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

<To**********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Here's a good one for the gurus out there.

I'm building a custom application that will query a web-service to get
data. The users are broken into two groups. Group 1 is the in-office
staff that are connected to the network. Group 2 is the remote staff
that must connect via dial-up connection to the Internet to use the
web-service.

The user (a.k.a. boss) would like the application to automatically
close the dial-up connection if there hasn't been any activity for 10
minutes. Anyone like to share a way to programmatically launch a
dial-up connection and then close it from within my application? Even
pointing me to KB articles would be good.


Copied from Herfried's post from last year (google is great):

\\\

' Written by Herfried K. Wagner.
Public Class InternetDialer
Public Declare Function InternetAutodial Lib "wininet.dll" ( _
ByVal dwFlags As Int32, _
ByVal hwndParent As IntPtr _
) As Boolean

Private Const INTERNET_AUTODIAL_FORCE_ONLINE As Int32 = &H1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED As Int32 = &H2
Private Const INTERNET_AUTODIAL_FAILIFSECURITYCHECK As Int32 = &H4
Private Const INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT As Int32 = &H8

Private Declare Function InternetAutodialHangup Lib "wininet.dll" ( _
ByVal dwReserved As Int32 _
) As Boolean

Public Enum AutoDialOptions
ForceOnline = INTERNET_AUTODIAL_FORCE_ONLINE
ForceUnattended = INTERNET_AUTODIAL_FORCE_UNATTENDED
FailIfSecurityCheck = INTERNET_AUTODIAL_FAILIFSECURITYCHECK
OverrideNetPresent = INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT
End Enum

Public Shared Sub Dialup(ByVal Options As AutoDialOptions)
Dialup(Options, IntPtr.Zero)
End Sub

Public Shared Sub Dialup(ByVal Options As AutoDialOptions, ByVal Parent
As Control)
Dialup(Options, Parent.Handle)
End Sub

Public Shared Sub Dialup( _
ByVal Options As AutoDialOptions, _
ByVal hwndParent As IntPtr _
)
If Not InternetAutodial(Options, hwndParent) Then
Throw _
New ApplicationException( _
"Error dialling the default internet connection." _
)
End If
End Sub

Public Shared Sub Hangup()
If Not InternetAutodialHangup(0) Then
Throw _
New ApplicationException( _
"Error disconnecting internet connection." _
)
End If
End Sub
End Class
///

HTH,
Mythran

Mar 28 '06 #2

P: n/a
Thanks Mythran! For some reason all I could find was for the
MarshallSoft component (which would've been the last resort). Then
right before reading your post I found
http://www.developerfusion.co.uk/show/1920/1/ so I'm sure one of the
two will work.

Thanks again!

Mar 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.