Private Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasHangUp Lib "rasapi32.dll" Alias "RasHangUpA" (ByVal hRasConn As Long) As Long
Private Type RasConn
dwSize As Long
hRasConn As Long
szEntryName(256) As Byte
szDeviceType(16) As Byte
szDeviceName(128) As Byte
End Type
Public Sub Disconnect()
Dim i As Long
Dim lpRasConn(255) As RasConn
Dim lpcb As Long
Dim lpcConnections As Long
Dim hRasConn As Long
Dim returncode As Long
lpRasConn(0).dwSize = 412
lpcb = 256 * lpRasConn(0).dwSize
lpcConnections = 0
returncode = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)
If returncode = 0 Then
For i = 0 To lpcConnections - 1
hRasConn = lpRasConn(i).hRasConn
returncode = RasHangUp(ByVal hRasConn)
Next i
End If
End Sub
Сейчас этот форум просматривают: Google-бот и гости: 64