• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Dialup connection

Is it possible from VB code to connect to internet using one of my windows dialup connections? The purpose of my program is to connect to a server and then transfer some files
1 Solution
I have the answer if you release the current answer...

     Private Declare Function RasEnumEntries Lib "RasApi32.dll" Alias "RasEnumEntriesA" (ByVal
     reserved As String, ByVal lpszPhonebook As String, lprasenumparams As Any, lpcb As Long,
     lpcentries As Long) As Long

     Private Const RAS_MAXENTRYNAME As Integer = 256

     Private Type RasEntryName
         dwSize As Long
         szEntryName(RAS_MAXENTRYNAME) As Byte
     End Type

     Private Sub Command1_Click()

     Dim htemp As Long
     Dim tt As RasEntryName
     Dim lpcb As Long
     Dim lpcentries As Long
     Dim i As Integer
     Dim en As String
     Dim FIND As Boolean
     Dim Ret As Long


     tt.dwSize = 26
     lpcb = RAS_MAXENTRYNAME * tt.dwSize
     lpcentries = 0
     Ret = RasEnumEntries(vbNullString, vbNullString, tt, lpcb, lpcentries)

     For i = 0 To RAS_MAXENTRYNAME - 1
         If tt.szEntryName(i) > 31 Then
             FIND = True
             en = en & Chr(tt.szEntryName(i))
         End If
         If tt.szEntryName(i) = 0 And FIND = True Then
             FIND = False
             List1.AddItem Trim(en)
             en = "" 
         End If

     End Sub

     Private Sub List1_DblClick()

     Dim res
     res = Shell("rundll32.exe rnaui.dll,RnaDial " & List1.List(List1.ListIndex), vbNormalFocus)

     End Sub

here is a real shortcut
Shell ("RUNDLL32.EXE RNAUI.DLL,RnaDial " + name_of_your_DUN_connection)

cvogtAuthor Commented:
Excellent! This works very nice. Thanks to both LeeGar and Slashear
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now