Hy
Weis jemand wie ich mit VB die Internetverbindung trennen kann.
Danke fürs lesen.
Stefan
Hy
Weis jemand wie ich mit VB die Internetverbindung trennen kann.
Danke fürs lesen.
Stefan
’ *** disconnect from the internet using VB
Private Const RAS_MAXENTRYNAME As Long = 256
Private Const RAS_MAXDEVICETYPE As Long = 16
Private Const RAS_MAXDEVICENAME As Long = 128
Private Const RAS_RASCONNSIZE As Long = 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“ 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
Public Sub HangUpConnection()
Dim i As Long
Dim lpRasConn(255) As RasConn
Dim lpcb As Long
Dim lpcConnections As Long
Dim hRasConn As Long
Dim nRet As Long
lpRasConn(0).dwSize = RAS_RASCONNSIZE
lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
lpcConnections = 0
nRet = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)
If nRet = ERROR_SUCCESS Then
For i = 0 To lpcConnections - 1
hRasConn = lpRasConn(i).hRasConn
nRet = RASHangUp(ByVal hRasConn)
Next
End If
End Sub