I am trying to create a list box that contains all the Dialup Connections listed in the Dial-Up Netorking folder. Is there an easy/quick way to accomplish this?
Printable View
I am trying to create a list box that contains all the Dialup Connections listed in the Dial-Up Netorking folder. Is there an easy/quick way to accomplish this?
The code below enumerates all of the dial up networking connections on the system and outputs them to a combobox (combo1):
--Module Code--
Public 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
Public Const RAS95_MaxEntryName = 256
Public Type RASENTRYNAME95
dwsize As Long
szentryname(RAS95_MaxEntryName) As Byte
End Type
--Form Code--
Dim s As Long, l As Long, ln As Long, a$
ReDim R(255) As RASENTRYNAME95
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)
Combo1.AddItem Left$(a$, InStr(a$, Chr$(0)) - 1)
Next
Hope this helps you,
... and check for none listed
Code:If ln = 0 Then
Combo1.AddItem "No Dial-Up connections found!" End If
Thanks gfrench and Steven McGarva, I posted this question about 2 weeks ago, although I just got a link to some non-free activeX controls, so thanks to ssrp for posting it again!
If you guys are playing with DUN and the like you might have fun implementing all the API stuff on different platforms, cause some of the implementations have a different syntax... I went and got the socketwrench stuff from catalyst.com. Its free and saved me a lot of hassle. I have some classes and stuff if anyone really wants to get their hands dirty, just mail me and lemme know
Cya