I cant take credit for this. I found it on the internet ages ago:
use it like:
rasResult = ras.Connect("VadalsVPN")
__________________________________________________ ____________
Imports System
Imports System.Runtime.InteropServices
Public Class RASDialup
Private Declare Auto Function InternetDial Lib "wininet" _
(ByVal hwndParent As IntPtr, _
ByVal lpszConnection As String, _
ByVal dwFlags As Integer, _
ByRef lpdwConnection As Integer, _
ByVal dwReserved As Integer) As Integer
'Public Declare Auto Function InternetDial Lib "wininet.dll" (ByVal hwnd As
IntPtr, <[In]()> ByVal lpszConnectoid As String, ByVal dwFlags As Long,
ByRef lpdwConnection As Integer, ByVal dwReserved As Long) As Integer
'Public Declare Auto Function InternetDial Lib "wininet.dll" (ByVal hwnd As
IntPtr, <[In]()> ByVal lpszConnectoid As String, ByVal dwFlags As
System.UInt32, ByRef lpdwConnection As Integer, ByVal dwReserved As
System.UInt32) As Integer
'ToDo: Unsigned Integers not supported
'ToDo: Unsigned Integers not supported
Public Declare Auto Function InternetHangUp Lib "wininet.dll" (ByVal
lpdwConnection As Integer, ByVal dwReserved As Long) As Integer 'ToDo:
Unsigned Integers not supported
'Public Declare Auto Function InternetHangUp Lib "wininet.dll" (ByVal
lpdwConnection As Integer, ByVal dwReserved As System.UInt32) As Integer
'ToDo: Unsigned Integers not supported
Public Enum DialUpOptions
INTERNET_AUTODIAL_FORCE_ONLINE = &H1
INTERNET_AUTODIAL_FORCE_UNATTENDED = &H2
INTERNET_DIAL_FORCE_PROMPT = &H2000
INTERNET_DIAL_SHOW_OFFLINE = &H4000
INTERNET_DIAL_UNATTENDED = &H8000
End Enum 'DialUpOptions
'
'
'INTERNET_AUTODIAL_FORCE_ONLINE Forces an online connection.
'
'INTERNET_AUTODIAL_FORCE_UNATTENDED Forces an unattended Internet dial-up.
If
'user intervention is required, the function will fail.
'
'INTERNET_DIAL_FORCE_PROMPT Ignores the "dial automatically" setting and
'forces the dialing user interface to be displayed.
'
'INTERNET_DIAL_UNATTENDED Connects to the Internet through a modem, without
'displaying a user interface, if possible. Otherwise, the function will wait
'for user input.
'
'INTERNET_DIAL_SHOW_OFFLINE
'
Private m_connectionnumber As Integer
Public ReadOnly Property ConnectionNumber() As Integer
Get
Return m_connectionnumber
End Get
End Property
Public Function Connect(ByVal m_ConnectionName As String) As Integer
Dim retVal As Integer
retVal = InternetDial(IntPtr.Zero, m_ConnectionName, &H8000,
m_connectionnumber, 0)
Return retVal
End Function 'Connect
Public Sub Disconnect()
InternetHangUp(m_connectionnumber, 0)
End Sub 'Disconnect
End Class 'RASDialup
"Tibby" <ti***@tiberiansun.us> wrote in message
news:od********************************@4ax.com...
Well, I've found the appropriate RAS API's, so I've got someone to
start, but it looks like I will have to do it in either C# or C++, I'm
not seeing a good way of doing it in VB.NET, unless I can figure out
how to pass an address of a delegate and provide an event interface
for the delegate.....
I'm willing to collaborate if that's what your looking for.....
tibbyATtiberiansunDOTus (Following your logic :) )
Tibby
On Mon, 12 Jul 2004 09:39:57 +0100, "MadCrazyNewbie" <te**@nospam.com>
wrote:
Hi Tibby,
I`ve been looking for something similar, althought not at any great
depth,and i carn`t seem to find anything either:(
If you find out, could you let me know?
simonDOTgreenATrixDOTcoDOTuk (Replace the Captials with the appropriate
symbol)
Many Thanks
MCN(Si)
"Tibby" <ti***@tiberiansun.us> wrote in message
news:34********************************@4ax.com.. . Okay, I've been searching, and asking and hoping for a bone, and
thinking I may be on the wrong path. Everyone has seen either AOL's
or NetZero's dialer, I need to make one of those. I'm planning to
make it fairley generic, but make it customizable. Basically, I don't
want to have to have my users go through the DUN setup for windows, I
would like them to just click and go.
I think the track I need to go on is the RAS API, but not sure at this
point. I hope I'm making sense on this, it's 2:30 am and I'm going
nutz trying to find a solution.
Thanks...