|
-
Aug 25th, 2000, 08:57 AM
#1
Thread Starter
New Member
I was using the filesystemobject to get the size of the fixed drives on my machine. However, the totalsize property returns a 20 GB drive and I only have an 8 GB drive. Is there any way to get the correct size, or do I need to do it a different way?
That's not a BUG, It's a feature!
VB6 Professional Service Pack 3
Windows CE Embedded Visual Tools 3
-
Aug 25th, 2000, 09:13 AM
#2
You can use GetFreeDiskSpaceEx.
Code:
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32.dll" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As ULARGE_INTEGER, lpTotalNumberOfBytes As ULARGE_INTEGER, lpTotalNumberOfFreeBytes As ULARGE_INTEGER) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type ULARGE_INTEGER
LowPart As Long
HighPart As Long
End Type
Dim FreeUser As ULARGE_INTEGER
Dim Total As ULARGE_INTEGER
Dim FreeSys As ULARGE_INTEGER
Dim Temp As Currency
Dim fTemp As Currency
Private Sub Command1_Click()
GetDiskFreeSpaceEx "C:\", FreeUser, Total, FreeSys
CopyMemory Temp, Total, 8
CopyMemory fTemp, FreeUser, 8
Print "Total Space: " & (CCur(Temp) * 10000) / 1000000000 & " GB"
Print "Free Space: " & (CCur(fTemp) * 10000) / 1000000000 & " GB"
End Sub
-
Aug 25th, 2000, 09:29 AM
#3
Thread Starter
New Member
That's not a BUG, It's a feature!
VB6 Professional Service Pack 3
Windows CE Embedded Visual Tools 3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|