如何获取硬盘剩余磁盘空间?《API》 Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" _ Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, _ lpFreeBytesAvailableToCaller As Currency, _ lpTotalNumberOfBytes As Currency, _ lpTotalNumberOfFreeBytes As Currency) As Long Private Sub Form_Click() Dim Status As Long Dim TotalBytes As Currency Dim FreeBytes As Currency Dim BytesAvailableToCaller As Currency Status = GetDiskFreeSpaceEx("c:", BytesAvailableToCaller, _ TotalBytes, FreeBytes) If Status <> 0 Then MsgBox Format(TotalBytes * 10000, "#,##0"), , "Total Bytes" MsgBox Format(FreeBytes * 10000, "#,##0"), , "Free Bytes" MsgBox Format(BytesAvailableToCaller * 10000, "#,##0"), , _ "Bytes Available To Caller" End If End Sub http://support.microsoft.com/kb/q202455/
|
|