Results 1 to 3 of 3

Thread: VOLUME OF HDD

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 1999
    Location
    karachi,sindh,pakistan
    Posts
    24
    HOW CAN I GET THE VOLUME OF HARDDISK DRIVE IF I AM
    USING VISUAL BASIC 5 WITH WINDOWS NT
    I ALREADY GOT THE VOLUME USING VB5 AND WIN95

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754

    paste this into a form

    Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
    Private Sub Form_Load()
    Dim r As Long, BytesFreeToCalller As Currency, TotalBytes As Currency
    Dim TotalFreeBytes As Currency, TotalBytesUsed As Currency
    'the drive to find
    Const RootPathName = "C:\"
    'get the drive's disk parameters
    Call GetDiskFreeSpaceEx(RootPathName, BytesFreeToCalller, TotalBytes, TotalFreeBytes)
    'show the results, multiplying the returned
    'value by 10000 to adjust for the 4 decimal
    'places that the currency data type returns.
    Me.AutoRedraw = True
    Me.Cls
    Me.Print
    Me.Print " Total Number Of Bytes:", Format$(TotalBytes * 10000, "###,###,###,##0") & " bytes"
    Me.Print " Total Free Bytes:", Format$(TotalFreeBytes * 10000, "###,###,###,##0") & " bytes"
    Me.Print " Free Bytes Available:", Format$(BytesFreeToCalller * 10000, "###,###,###,##0") & " bytes"
    Me.Print " Total Space Used :", Format$((TotalBytes - TotalFreeBytes) * 10000, "###,###,###,##0") & " bytes"
    End Sub



    DOH! thought you meant free space not volume label, my brain's on back order today - sorry.


    [Edited by crispin on 10-04-2000 at 04:57 AM]
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845


    Dir("c:\", vbVolume)' returns the volume label
    Mark
    -------------------

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