先引用,菜单 -> 工程 -> 引用 -> micsoft scripting runtimeDim tCD As Scripting.Drive
Dim tMS As New Scripting.FileSystemObject
For Each tCD In tMS.Drives
If tCD.DriveType = Fixed Then
Debug.Print tCD.TotalSize
End If
Next
Dim tMS As New Scripting.FileSystemObject
For Each tCD In tMS.Drives
If tCD.DriveType = Fixed Then
Debug.Print tCD.TotalSize
End If
Next
解决方案 »
- 怎样处理控件的响应事件
- vb开发控件的问题
- 自己写的记事本中怎么实现与系统自带的记事本一样的自动换行功能啦!
- 再次散分,想问一下,msflexgrid控件+TEXT控件如何来进行有效的编辑功能?紧急等待中。。。
- 隐藏表中数据和显示问题
- 急!菜鸟提问:如何用ADO的command对象调用Access的查询(存储过程)
- 字符串的长度问题
- 如何设置Com端口速度,win2000
- 50分!!!!(请教:关于WINSOCK控件发E-MAIL,不需要密码验证)
- 高手请进!!急!(大放血啊,嘿嘿)
- ###当窗体样式设为0时,如何才能象正常窗体一样用鼠标改变窗体的大小?
- 如何使一窗体,位于另一确定的窗体之上,而不是always on top
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long【别名】
GetDiskFreeSpaceA【说明】
获取与一个磁盘的组织有关的信息,以及了解剩余空间的容量 【返回值】
Long,非零表示成功,零表示失败。会设置GetLastError 【备注】
在采用FAT16格式的windows95系统中,如一个驱动器(分区)的容量超过了2GB,则不应使用这个函数。此时,这个函数能识别的最大分区容量只有2GB【参数表】
lpRootPathName - String,不包括卷名的一个磁盘根路径 lpSectorsPerCluster - Long,用于装载一个簇内扇区数的变量 lpBytesPerSector - Long,用于装载一个扇区内字节数的变量 lpNumberOfFreeClusters - Long,用于装载磁盘上剩余簇数的变量 lpTtoalNumberOfClusters - Long,用于装载磁盘上总簇数的变量实例:
'In general section
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As LongPrivate Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected] Dim Sectors as Long,Bytes as Long,FreeC as Long, TotalC as Long,Total as Long,Freeb as Long
'Retrieve information about the C: GetDiskFreeSpace "C:\", Sectors, Bytes, Freec, Totalc
'Set graphic mode to persistent
Me.AutoRedraw = True
'Print the information to the form
Me.Print " Path: C:\"
Me.Print " Sectors per Cluster:" + Str$(Sector)
Me.Print " Bytes per sector:" + Str$(Bytes)
Me.Print " Number Of Free Clusters:" + Str$(Freec)
Me.Print " Total Number Of Clusters:" + Str$(Totalc)
Total = rTotalc& * rSector& * rBytes&
Me.Print " Total number of bytes in path:" + Str$(Total)
Freeb = rFreec& * rSector& * rBytes&
Me.Print " Free bytes:" + Str$(Freeb)
End sub