Results 1 to 3 of 3

Thread: API Gurus only please!!!

  1. #1

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425

    Question

    Part of my app needs to calculate stuff about the Users hard disk(s) which would be done using the GetDiskFreeSpace API. The problem is that this will not work on Drives over 2GB in size, or FAT32 Drives. The recommended Microsoft solution is to use the GetDiskFreeSpaceEx API. My questions are this....


    1) Does the GetDiskFreeSpaceEx API use the same parameters as GetDiskFreeSpace?

    2) Will GetDiskFreeSpaceEx work with FAT16, sub 2GB drives, removing the need to use GetDiskFreeSpace at all?

    3) If not, Microsoft also recommend that you use the GetVersionEx API to determine the users Windows version. How can I distinguish between different versions of Win 95 when using this?

    Thanks in Advance!!

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Here's how you can use GetDiskFreeSpaceEx
    Code:
    Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
    
    Private Function GetFreeSpace(p_strDrive As String) As String
        Dim curTotalBytes As Currency
        Dim curFreeBytesToCaller As Currency
        Dim curTotalFreeBytes As Currency
        
        Call GetDiskFreeSpaceEx(strDrive, curFreeBytesToCaller, curTotalBytes, curTotalFreeBytes)
        GetFreeSpace = Format$(curTotalFreeBytes * 10000, "###,###,###,##0")
    End Function
    Example:


    MsgBox "Free space on drive C: is: " & GetFreeSpace("C:")



    This will get size of hard drives bigger then 2GB.

    Regards,

  3. #3

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    THX

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