首页  RSS订阅  繁體中文登录  注册  用户中心

您的位置:windows服务器

  • windows服务器
  • 断开拨号网络的连接VB源代码(2011-09-21)

    Option Explicit
    Private Declare Function RasHangUp Lib "RasApi32.DLL" Alias "RasHangUpA" (ByVal hRasConn As Long) As Long
    Private Declare Function RasEnumConnections Lib "RasApi32.DLL" Alias "RasEnumConnectionsA" (lprasconn As Any, lpcb As Long, lpcConnections As Long) As Long

    Const RAS95_MaxEntryName = 256
    Const RAS95_MaxDeviceName = 128
    Const RAS_MaxDeviceType = 16

    Private Type RASCONN95
    'set dwsize to 412
    dwSize As Long
    hRasConn As Long
    szEntryName(RAS95_MaxEntryName) As Byte
    szDeviceType(RAS_MaxDeviceType) As Byte
    szDeviceName(RAS95_MaxDeviceName) As Byte
    End Type

    Private Sub Command1_Click()
    Dim lngRetCode As Long
    Dim lpcb As Long
    Dim lpcConnections As Long
    Dim intArraySize As Integer
    Dim intLooper As Integer

    ReDim lprasconn95(intArraySize) As RASCONN95
    lprasconn95(0).dwSize = 412
    lpcb = 256 * lprasconn95(0).dwSize
    lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)

    If lngRetCode = 0 Then
    If lpcConnections > 0 Then
    For intLooper = 0 To lpcConnections - 1
    RasHangUp lprasconn95(intLooper).hRasConn
    Next intLooper
    Else
    MsgBox "没有拨号网络连接!", vbInformation
    End If
    End If
    End Sub

    上一篇:4根双绞线的接法
    下一篇:分析那些百度长期不收录的黑名单页面