Results 1 to 3 of 3

Thread: Free Disk space bigger than 2 GB

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    10

    Question Free Disk space bigger than 2 GB

    Hi all,

    How can I know the free disk space on a drive when this quantity is bigger than 2 GB!?

    The GetDiskFreeSpace API is limited to 2 GB.

    Any suggestion? I work with VB6 under Win 98.

    Thanx in advanced.
    Javier R.

  2. #2
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    i dont think there's anything you could do, maybe get total disk size and subract use space

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    For over 2GB disks use the GetDiskFreeSpaceEx API Function:
    VB Code:
    1. Create a new project, and add this code to Form1:
    2. Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
    3. Private Sub Form_Load()
    4.     Dim r As Long, BytesFreeToCalller As Currency, TotalBytes As Currency
    5.     Dim TotalFreeBytes As Currency, TotalBytesUsed As Currency
    6.     'the drive to find
    7.     Const RootPathName = "C:\"
    8.     'get the drive's disk parameters
    9.     Call GetDiskFreeSpaceEx(RootPathName, BytesFreeToCalller, TotalBytes, TotalFreeBytes)
    10.     'show the results, multiplying the returned
    11.     'value by 10000 to adjust for the 4 decimal
    12.     'places that the currency data type returns.
    13.     Me.AutoRedraw = True
    14.     Me.Cls
    15.     Me.Print
    16.     Me.Print " Total Number Of Bytes:", Format$(TotalBytes * 10000, "###,###,###,##0") & " bytes"
    17.     Me.Print " Total Free Bytes:", Format$(TotalFreeBytes * 10000, "###,###,###,##0") & " bytes"
    18.     Me.Print " Free Bytes Available:", Format$(BytesFreeToCalller * 10000, "###,###,###,##0") & " bytes"
    19.     Me.Print " Total Space Used :", Format$((TotalBytes - TotalFreeBytes) * 10000, "###,###,###,##0") & " bytes"
    20. End Sub
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width