473,395 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Auto-stop DUN via VB.Net?

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
2 1373

<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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Manlio Perillo | last post by:
Hi. This post follows "does python have useless destructors". I'm not an expert, so I hope what I will write is meaningfull and clear. Actually in Python there is no possibility to write code...
1
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the...
5
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge...
20
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
6
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I...
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
5
by: maya | last post by:
at work they decided to center divs thus: body {text-align:center} #content {width: 612px; text-align:left; margin: 0 auto 0 auto; } this works fine in IE & FF, EXCEPT in FF it doesn't work if...
22
by: nospam_news | last post by:
I currently get asked about my usage of "auto". What is it for? The keyword is clearly superflous here. In contrast to the huge majority of C/C++ developers I write definitions very explicitly...
2
by: Piotr K | last post by:
Hi, I've encountered a strange problem with Firefox which I don't have any idea how to resolve. To the point: I've <divelement with a style "height: auto" and I want to retrieve this value...
21
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.