home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / SourceCode558122182002.psc / SCO / cDirList.cls < prev    next >
Encoding:
Visual Basic class definition  |  2002-02-18  |  1.9 KB  |  64 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cDirList"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. Private mCol As New Collection
  17.  
  18. Public Function Add(lAttrib As Long, dtCreationTime As Date, dtLastAccessTime As Date, dtLastWriteTime As Date, lFileSize As Long, sFilename As String) As cDirItem
  19.    Dim newItem As New cDirItem
  20.    
  21.    With newItem
  22.       .Archive = (lAttrib And FILE_ATTRIBUTE_ARCHIVE)
  23.       .Compressed = (lAttrib And FILE_ATTRIBUTE_COMPRESSED)
  24.       .Directory = (lAttrib And FILE_ATTRIBUTE_DIRECTORY)
  25.       .Hidden = (lAttrib And FILE_ATTRIBUTE_HIDDEN)
  26.       .Normal = (lAttrib And FILE_ATTRIBUTE_NORMAL)
  27.       .Offline = (lAttrib And FILE_ATTRIBUTE_OFFLINE)
  28.       .ReadOnly = (lAttrib And FILE_ATTRIBUTE_READONLY)
  29.       .System = (lAttrib And FILE_ATTRIBUTE_SYSTEM)
  30.       .Temporary = (lAttrib And FILE_ATTRIBUTE_TEMPORARY)
  31.       .CreationTime = dtCreationTime
  32.       .LastAccessTime = dtLastAccessTime
  33.       .LastWriteTime = dtLastWriteTime
  34.       .FileSize = lFileSize
  35.       .Filename = sFilename
  36.    End With
  37.    mCol.Add newItem, sFilename
  38. End Function
  39.  
  40. Public Function Clear()
  41.    Dim lIndex As Long
  42.    If mCol.Count > 0 Then
  43.       For lIndex = 1 To mCol.Count - 1
  44.          mCol.Remove lIndex
  45.       Next
  46.    End If
  47. End Function
  48.  
  49. Public Function Item(Index As Variant) As cDirItem
  50. Attribute Item.VB_UserMemId = 0
  51.    Set Item = mCol(Index)
  52. End Function
  53.  
  54. Public Function Count() As Long
  55.    Count = mCol.Count
  56. End Function
  57.  
  58. Public Function NewEnum() As IUnknown
  59. Attribute NewEnum.VB_UserMemId = -4
  60. Attribute NewEnum.VB_MemberFlags = "40"
  61.    Set NewEnum = mCol.[_NewEnum]
  62. End Function
  63.  
  64.