HDD free space? 
Author Message
 HDD free space?

I am sorry I am quiet sure this question asked before, but I checked all
them essages and I could not find. Is there anybody can send me soem
info about how can I determine the free HDD space? I plan to use Win 3.x
, so I hope anybody can remember the api for Win 3.x.

Regards,

HAN CICIMEN




Fri, 10 Aug 2001 03:00:00 GMT  
 HDD free space?
This is the 32-bit code:

'Code:
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 Long
Function GetFreeSpace(sPath As String) As Double
    Dim Sectors As Long, Bytes As Long, FreeC As Long, TotalC As Long, Total
As Long, Freeb As Long
    GetDiskFreeSpace sPath, Sectors, Bytes, FreeC, TotalC
    GetFreeSpace = FreeC * Sectors * Bytes
End Function

'Use:
    MsgBox GetFreeSpace("C:\")

I don't know the 16-bit api, but I think it's similar to this one.

HTH,
Pieter Philippaerts
http://users.turboline.be/btl10148/


Quote:
>I am sorry I am quiet sure this question asked before, but I checked all
>them essages and I could not find. Is there anybody can send me soem
>info about how can I determine the free HDD space? I plan to use Win 3.x
>, so I hope anybody can remember the api for Win 3.x.

>Regards,

>HAN CICIMEN





Fri, 10 Aug 2001 03:00:00 GMT  
 HDD free space?


?I am sorry I am quiet sure this question asked before, but I checked all
?them essages and I could not find. Is there anybody can send me soem
?info about how can I determine the free HDD space? I plan to use Win 3.x
?, so I hope anybody can remember the api for Win 3.x.

Download the freeware VBASM programming utilities from the
Softcircuits web site (http://www.softcircuits.com/). You should find
an example on how to use the functions unders Windows 3.x.

Paul
~~~~



Fri, 10 Aug 2001 03:00:00 GMT  
 HDD free space?
Is there another API call for large HDD?  The following code returns the
same value for both Free space (which is correct) and DriveCapacity.
On my PC, the GetDiskFreeSpace API returns the same value for
lpNumberOfFreeClusters and lpTtoalNumberOfClusters.  OS=Win98

If you're looking for freespace (which is probably most critical), this
works great, but if you need a percentage used... no dice.

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 Long

Function GetDriveCap(sPath As String) As Double
    Dim Sectors As Long, Bytes As Long, FreeC As Long, TotalC As Long, Total
As Long, Freeb As Long
    GetDiskFreeSpace sPath, Sectors, Bytes, FreeC, TotalC
    GetDriveCap = TotalC * Sectors * Bytes
End Function

Function GetFreeSpace(sPath As String) As Double
    Dim Sectors As Long, Bytes As Long, FreeC As Long, TotalC As Long, Total
As Long, Freeb As Long
    GetDiskFreeSpace sPath, Sectors, Bytes, FreeC, TotalC
    GetFreeSpace = FreeC * Sectors * Bytes
End Function

Private Sub Form_Load()
    Static llMB As Long, lsDriveRoot As String
    llMB = 1024000
    lsDriveRoot = "C:\"
    Label1.Caption = Format(GetFreeSpace(lsDriveRoot) / llMB, "##,##0.000")
& " MB free"
    Label2.Caption = Format(GetDriveCap(lsDriveRoot) / llMB, "##,##0.000") &
" MB capacity"
    '
End Sub



Sat, 11 Aug 2001 03:00:00 GMT  
 HDD free space?
Quote:

>Is there another API call for large HDD?  The following code returns the
>same value for both Free space (which is correct) and DriveCapacity.
>On my PC, the GetDiskFreeSpace API returns the same value for
>lpNumberOfFreeClusters and lpTtoalNumberOfClusters.  OS=Win98

<cut>

see http://home.earthlink.net/~butlerbob/vb/disk/getspace.htm



Sat, 11 Aug 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Space Space Space Space Space Space Space

2. Space Space Space Space Space Space Space

3. Space Space Space Space Space Space Space

4. HDD SPACE, PLEASE HELP

5. Need to know HD space and free space

6. How To Retrieve Free Disk Space and Total Disk Space

7. ? - Calculating Free Memory/Free Disk Space

8. Get dir size & free space programatically

9. Network disk free space

10. Free space disk in Access 2

11. report with free drive space

12. report with free drive space

 

 
Powered by phpBB® Forum Software