Office中国论坛/Access中国论坛

标题: 【Access小品】获取硬盘信息函数 [打印本页]

作者: todaynew    时间: 2010-10-19 16:54
标题: 【Access小品】获取硬盘信息函数
本帖最后由 todaynew 于 2010-10-19 16:58 编辑

[attach]43873[/attach]

Function GetDrive() As String
'引用:Microsoft Scripting Runtime
'功能:返回驱动器字符串。
'示例:me.驱动器列表.RowSource="驱动器;网络共享名;类型;空间;可用空间;" & GetDrive     列表框或组合框列标题选是
Dim myFSO As New FileSystemObject
Dim myDr As Drive
Dim t As String
For Each myDr In myFSO.Drives
    If myDr.IsReady = True Then
        Select Case myDr.DriveType
            Case 0: t = "Unknown"
            Case 1: t = "Removable"
            Case 2: t = "Fixed"
            Case 3: t = "Network"
            Case 4: t = "CD-ROM"
            Case 5: t = "RAM Disk"
        End Select
        GetDrive = GetDrive & myDr.DriveLetter & ":;" & myDr.ShareName & ";" & t & ";"
        GetDrive = GetDrive & myDr.TotalSize / 1024 & ";" & myDr.FreeSpace / 1024 & ";"
    End If
Next myDr
End Function

[attach]43872[/attach]





作者: lkkl66    时间: 2010-10-19 23:19
好东西  没人收   —— 我来收了    谢谢!
作者: li08hua    时间: 2010-10-20 02:19
todaynew 又出大作了,下了!
作者: xuwenning    时间: 2010-10-20 08:53
已经收藏了
谢谢分享




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3