解除網蟲心病VB做定時斷線程序

字號:

運行VB 6,向窗體添加7個Label控件、1個Timer控件、3個Text文本輸入框以及4個Command按鈕。
    原理簡介:用Timer控件的True或者False值,控制倒計時的開始,當?shù)竭_設定時間的時候,彈出對話框提示斷開連接。
    Option Explicit
    Dim Hours As Integer
    Dim Minutes As Integer
    Dim Seconds As Integer
    Dim time As Date
    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
    dwSize As Long
    hRasConn As Long
    szEntryName(RAS95_MaxEntryName) As Byte
    szDeviceType(RAS_MaxDeviceType) As Byte
    szDeviceName(RAS95_MaxDeviceName) As Byte
    End Type
    下面一段代碼是對Timer的控制,以及到設定時間的時候斷開連接的代碼
    Private Sub Timer1_Timer()
    Timer1.Enabled = False
    If (Format100 100time, "hh") && ":" && Format100 100time, "nn") && ":" && Format100 100time, "ss"))〈〉"00:00:00" Then
    time = DateAdd("s", -1, time)
    Label1.Visible = False
    Label1.Caption = Format100 100time, "hh") && ":" && Format100 100time, "nn") && ":" && Format100 100time, "ss")
    Label1.Visible = True
    Timer1.Enabled = True
    Else