Hallo zusammen,
ich habe mit folgender Funktion über Jahre erfolgreich die DFÜ-Verbindungen aus dem System ausgelesen.
Private Function RAS_GetConnections9x() As Variant
Dim lpRasEntryName9x As RASENTRYNAME9X
Dim lpcb As Long
Dim cEntries As Long
Dim t_Buff As Long
Dim t_ptr As Long
Dim t_dwSize As Long
Dim nRet As Long
Dim i As Long
Dim RASList As Variant
RAS_GetConnections9x = RASList
lpcb = 0
' Initialize the dwSize field
lpRasEntryName9x.dwSize = LenB(lpRasEntryName9x) + (LenB(lpRasEntryName9x) _
Mod 4)
' Call RasEnumEntries with lpcb = 0 to find out the required
' input buffer size
nRet = RasEnumEntries(vbNullString, vbNullString, _
lpRasEntryName9x, lpcb, cEntries)
' If any other error besides Error_Buffer_Too_Small exit the procedure
If nRet = 0 Then
Exit Function
End If
If nRet <> 603 Then
Debug.Print "RasEnumEntries failed: " + CStr(nRet)
Exit Function
End If
' Allocate input buffer with required size
t_Buff = GlobalAlloc(GPTR, lpcb)
' Initialize the first entry
CopyMemory ByVal t_Buff, lpRasEntryName9x, LenB(lpRasEntryName9x)
' Call RasEnumEntries to enumerate the phonebook entries
' in the default system phonebook
nRet = RasEnumEntries(vbNullString, vbNullString, ByVal t_Buff, lpcb, _
cEntries)
If nRet = 0 Then ' RasEnumEntries returned success
t_ptr = t_Buff
' Copy the values of the first entry
CopyMemory lpRasEntryName9x, ByVal t_ptr, LenB(lpRasEntryName9x)
' Add the phone book entry to the combo box
ReDim RASList(0)
RASList(0) = ByteToString(lpRasEntryName9x.szEntryName)
t_dwSize = lpRasEntryName9x.dwSize
t_ptr = t_ptr + t_dwSize
' Add subsequent entries to the combo box
For i = 1 To cEntries - 1
CopyMemory lpRasEntryName9x, ByVal t_ptr, LenB(lpRasEntryName9x)
ReDim Preserve RASList(i)
RASList(i) = ByteToString(lpRasEntryName9x.szEntryName)
t_ptr = t_ptr + t_dwSize
Next i
Else ' RasEnumEntries returned an error
''MsgBox "RasEnumEntries failed: " + CStr(nRet)
End If
' Free the allocated input buffer
GlobalFree (t_Buff)
RAS_GetConnections9x = RASList
End Function Da ich Windows Vista in der Kompabilität übersprungen habe, ist es mir wohl vorher nicht aufgefallen,
aber seitdem scheint es nicht mehr zu funktionieren... Ich bekomme einfach keine Daten mehr geliefert.
Kennt jemand das Problem und weiß abhilfe?
Grüße
Madmax |