У меня все работает вот так:
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 Type RASENTRYNAME95 dwSize As Long szEntryName(&H100) As Byte End Type Public Function GetConList(ConList() As String) As Long ' Получение списка соединений Dim udtRasEntryName(255) As RASENTRYNAME95, lpcb As Long Dim TempBuffer As String Erase ConList udtRasEntryName(0).dwSize = &H108 lpcb = udtRasEntryName(0).dwSize * &H100 If Not RasEnumEntries(vbNullString, vbNullString, udtRasEntryName(0), lpcb, GetConList) = &H0 Then Exit Function If GetConList > 0 Then ReDim ConList(GetConList - &H1) For GetConList = &H0 To GetConList - &H1 TempBuffer = StrConv(udtRasEntryName(GetConList).szEntryName(), vbUnicode) ConList(GetConList) = Left$(TempBuffer, InStr(TempBuffer, vbNullChar) - &H1) Next End Function
Ответить
|