日期:2008-11-11  浏览次数:20797 次

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' ShowDriveType
'
' 目的:
'
' 生成一个字符串,来描述给定 Drive 对象的驱动器类型。
'
' 示范下面的内容
'
' - Drive.DriveType
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function ShowDriveType(Drive)

    Dim S
  
    Select Case Drive.DriveType
    Case DriveTypeRemovable
        S = "Removable"
    Case DriveTypeFixed
        S = "Fixed"
    Case DriveTypeNetwork
        S = "Network"
    Case DriveTypeCDROM
        S = "CD-ROM"
    Case DriveTypeRAMDisk
        S = "RAM Disk"
    Case Else
        S = "Unknown"
    End Select

    ShowDriveType = S

End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' ShowFileAttr
'
' 目的:
'
' 生成一个字符串,来描述文件或文件夹的属性。
'
' 示范下面的内容
'
' - File.Attributes
' - Folder.Attributes
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function ShowFileAttr(File) ' File 可以是文件或文件夹

    Dim S
      Dim Attr
    
    Attr = File.Attributes

    If Attr = 0 Then
        ShowFileAttr = "Normal"
        Exit Function
    End If

    If Attr And FileAttrDirectory  Then S = S & "Directory "
    If Attr And FileAttrReadOnly   Then S = S & "Read-Only "
    If Attr And FileAttrHidden     Then S = S & "Hidden "
    If Attr And FileAttrSystem     Then S = S & "System "
    If Attr And FileAttrVolume     Then S = S & "Volume "
    If Attr And FileAttrArchive    Then S = S & "Archive "
    If Attr And FileAttrAlias      Then S = S & "Alias "
    If Attr And FileAttrCompressed Then S = S & "Compressed "

    ShowFileAttr = S

End Function


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' GenerateDriveInformation
'
' 目的:
'
' 生成一个字符串,来描述可用驱动器的当前状态。
'
' 示范下面的内容
'
' - FileSystemObject.Drives
' - Iterating the Drives collection
' - Drives.Count
' - Drive.AvailableSpace
' - Drive.DriveLetter
' - Drive.DriveType
' - Drive.FileSystem
' - Drive.FreeSpace
' - Drive.IsReady
' - Drive.Path
' - Drive.SerialNumber
' - Drive.ShareName
' - Drive.TotalSize
' - Drive.VolumeName
'
'''''''''