clinktimers.cls

来自「这个例程及文档详细地介绍了VB6中的物件导向概念」· CLS 代码 · 共 60 行

CLS
60
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CLinkTimers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'********************************************************************************************
' CLinkTimers Collection Class Definition
'
' This class defines a collection which contains the CLinkTimer objects.
' Add is replaced by a new method - Insert - to allow CLinkTimer objects
' to be added directly. The objects are added using the TimerID as a key.
'
' Instancing is set to: 1 - Private
'********************************************************************************************
Option Explicit

'local variable to hold collection
Private mCol As Collection

Public Sub Insert(ByRef oCLinkTimer As CLinkTimer, Optional ByRef sKey As String)
    If Len(sKey) = 0 Then
        mCol.Add oCLinkTimer
    Else
        mCol.Add oCLinkTimer, sKey
    End If
End Sub

Public Property Get Item(vntIndexKey As Variant) As CLinkTimer
    Set Item = mCol(vntIndexKey)
End Property

Public Property Get Count() As Long
    Count = mCol.Count
End Property

Public Sub Remove(vntIndexKey As Variant)
    mCol.Remove vntIndexKey
End Sub

Public Property Get NewEnum() As IUnknown
    Set NewEnum = mCol.[_NewEnum]
End Property

Private Sub Class_Initialize()
    Set mCol = New Collection
End Sub

Private Sub Class_Terminate()
    Set mCol = Nothing
End Sub

⌨️ 快捷键说明

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