Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/10/2004, 10:56
RadicalEd
 
Fecha de Ingreso: octubre-2004
Ubicación: COLOMBIA
Mensajes: 240
Antigüedad: 20 años, 6 meses
Puntos: 3
Exclamación

NO LO HE PROBADO ASI QUE SUERTE

Const ERROR_SUCCESS = 0&
Const RAS_MAXENTRYNAME = 256
Const RAS_MAXDEVICETYPE = 16
Const RAS_MAXDEVICENAME = 128
Const RAS_RASCONNSIZE = 412
Private Type RasEntryName
dwSize As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
End Type
Private Type RasConn
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 "rasapi32.dll" (lpRasConn As Any, lpcb As Long, lpcConecctions As Long) As Long
Private Declare Function RasHangUp Lib "rasapi32.dll" Alias "RasHangUpA" (ByVal hRasConn As Long) As Long
Sub HangUp()
Dim i As Long
Dim lpRassConn(255) As RasConn
Dim lpcb As Long
Dim lpcConnections As Long
Dim hRasConn As Long
lpRasConn(0).dwSize = RAS_RASCONNSIZE
lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
lpcConnections = 0
ReturnCode = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)

If ReturnCode = ERROR_SUCCESS Then
For i = o To lpcConnections - 1
If Trim(CStr(lpRasConn(i).szEntryName)) = Trim(gstrispname) Then
hRasConn = lpRasConn(i).hRasConn
ReturnCode = RasHangUp(ByVal hRasConn)
End If
Next
End If
End Sub