⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpref.cls

📁 LineWatcher dials your ISP, keeps your connection alive and logs errors. Originally distributed as f
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CPref"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' RICHARD GOUTORBE ( rghome@reseau.org http://www.reseau.org/rg/ ) holds the copyright to all code in this document.
' You are granted a license to use this code under the following conditions:
' - You are free to modify the code in any way you see fit.
' - You are free to redistribute the code FOR NON-PROFIT PURPOSE provided that
'     1) appropriate credit is given to Richard Goutorbe, and
'     2) you do not charge any kind of fee for the code without the written permission of Richard Goutorbe.
' You are free to redistibute a binary compiled version of the code for any purpose, profit or non-profit.
' If you distribute the code in this form, you must give appropriate credit to Richard Goutorbe.
' PUBLISHING THE CODE ON OTHER WEB SITES, OR POSTING THE CODE ON OTHER WEB SITES FOR PUBLICATION WITHOUT THE WRITTEN PERMISSION OF RICHARD GOUTORBE, IS STRICTLY PROHIBITED.
Option Explicit
Private Const DEFAULT_PING_DELAY = 30

Public RASConnection As String
Public LogLevel As Integer '0=none, 1=minimal (default), 2=detailed
Private mPingHost_str As String
Private mPingDelay_long As Long
Private mAutoConnectDelay_long As Long

' Preferences are saved in the registry:
' HKEY_CURRENT_USER/Software/VB and VBA Program Settings/Linewatcher/Preferences
Const SECTION = "Preferences"

Public Property Get PingHost() As String
    PingHost = mPingHost_str
End Property
Public Property Let PingHost(ByVal new_value As String)
    mPingHost_str = Trim(new_value)
End Property

Public Property Get PingDelay() As Long
    PingDelay = mPingDelay_long
End Property
Public Property Let PingDelay(ByVal new_value As Long)
    If (new_value > 60) Then
        mPingDelay_long = 60
    ElseIf (new_value <= 0) Then
        mPingDelay_long = DEFAULT_PING_DELAY
    Else
        mPingDelay_long = new_value
    End If
End Property

Public Property Get AutoConnectDelay() As Long
    AutoConnectDelay = mAutoConnectDelay_long
End Property
Public Property Let AutoConnectDelay(ByVal new_value As Long)
    If (new_value > 60) Then
        mAutoConnectDelay_long = 60
    ElseIf (new_value <= 0) Then
        mAutoConnectDelay_long = 0
    Else
        mAutoConnectDelay_long = new_value
    End If
End Property

Public Sub LoadPref()
    RASConnection = GetProfileString(SECTION, "RASConnection", "")
    AutoConnectDelay = GetProfileInt(SECTION, "AutoConnectDelay", 0)
    PingDelay = GetProfileInt(SECTION, "PingDelay", 0)
    PingHost = GetProfileString(SECTION, "PingHost", "")
    LogLevel = GetProfileInt(SECTION, "LogLevel", 1)
    If (Len(RASConnection) = 0) Then
        Reset
    End If
End Sub

Public Sub SavePref()
    WriteProfileString SECTION, "RASConnection", RASConnection
    WriteProfileInt SECTION, "AutoConnectDelay", AutoConnectDelay
    WriteProfileInt SECTION, "PingDelay", PingDelay
    WriteProfileString SECTION, "PingHost", PingHost
    WriteProfileInt SECTION, "LogLevel", LogLevel
End Sub

Public Sub Reset()
    RASConnection = ""
    AutoConnectDelay = 0
    PingDelay = DEFAULT_PING_DELAY
    PingHost = "www.whitehouse.gov"
    LogLevel = 1
End Sub

Public Sub Show()
    Dim frmPref_obj As frmPref
    Set frmPref_obj = New frmPref
    Set frmPref_obj.Owner = Me
    frmPref_obj.Show vbModal
    Set frmPref_obj = Nothing
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -