Does anyone know how to get a list of available connections from dial up networking?
Printable View
Does anyone know how to get a list of available connections from dial up networking?
I believe your going to have to use the SocketWrench tools to do this.
'put this into a form with a listbox
Code:Private Const RAS_MAXENTRYNAME As Integer = 256
Private Const RAS_MAXDEVICETYPE As Integer = 16
Private Const RAS_MAXDEVICENAME As Integer = 128
Private Type RASENTRYNAME95
dwSize As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
End Type
Private Type RASCONN95
dwSize As Long
hRasConn As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
szDeviceType(RAS_MAXDEVICETYPE) As Byte
szDeviceName(RAS_MAXDEVICENAME) As Byte
End Type
Private Declare Function RasEnumConnections Lib _
"rasapi.32.dll" Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, lpConnections As Long) As Long
Private Declare Function RasEnumEntries Lib _
"rasapi32.dll" Alias "RasEnumEntriesA" (ByVal reserved As String, ByVal lpszPhoneBook As String, lprasentryname As Any, lpcb As Long, lpcEntries As Long) As Long
Private Sub Form_Load()
Dim Lar1 As Long
Dim s As Long
Dim L As Long
Dim ln As Long
Dim a As String
Dim r(255) As RASENTRYNAME95
Lar1 = 0
r(0).dwSize = 264
s = 256 * r(0).dwSize
L = RasEnumEntries(vbNullString, vbNullString, r(0), s, ln)
For L = 0 To ln - 1
a = StrConv(r(L).szEntryName(), vbUnicode)
List1.AddItem Left$(a, InStr(a, Chr$(0)) - 1)
Next
End Sub
That's a good code larryn. Thanks for it.
And to think, you don't need any tools, just API.
*feels embarassed* :rolleyes: