?? colregkeys.cls
字號:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "colRegKeys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'local variable to hold collection
Private mCol As Collection
Private mKey As Long
Public Sub Add(ByVal NewKey As ApiRegKey)
mCol.Add NewKey, NewKey.Name
End Sub
Public Property Get Item(vntIndexKey As Variant) As ApiRegKey
'used when referencing an element in the collection
'vntIndexKey contains either the Index or Key to the collection,
'this is why it is declared as a Variant
'Syntax: Set foo = x.Item(xyz) or Set foo = x.Item(5)
Set Item = mCol(vntIndexKey)
End Property
Public Property Get Count() As Long
'used when retrieving the number of elements in the
'collection. Syntax: Debug.Print x.Count
Count = mCol.Count
End Property
'\\ --[NewKey]---------------------------------------------------------
'\\ Creates and adds a new registry to this collection of subkeys.
'\\ -------------------------------------------------------------------
Public Function NewKey(ByVal Name As String) As ApiRegKey
Dim tmpKey As ApiRegKey
With tmpKey
.Name = Name
.ParentKey = Me.ParentKey
.OpenKey
End With
Me.Add tmpKey
Set NewKey = tmpKey
End Function
Friend Property Get ParentKey() As Long
ParentKey = mKey
End Property
Friend Property Let ParentKey(ByVal NewKey As Long)
mKey = NewKey
End Property
Public Sub Remove(vntIndexKey As Variant)
'used when removing an element from the collection
'vntIndexKey contains either the Index or Key, which is why
'it is declared as a Variant
'Syntax: x.Remove(xyz)
mCol.Remove vntIndexKey
End Sub
Public Property Get NewEnum() As IUnknown
'this property allows you to enumerate
'this collection with the For...Each syntax
Set NewEnum = mCol.[_NewEnum]
End Property
Private Sub Class_Initialize()
'creates the collection when this class is created
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
'destroys collection when this class is terminated
Set mCol = Nothing
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -