Results 1 to 3 of 3

Thread: Diskdrives informations...

  1. #1
    Guest

    Question

    I need to get information of system drives as much as possible. Like drive size and used space, name (and possibly way to change it) and other general information.

    I know that I can get driveinfo with one API command, but I can't remember what it is.

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    There's a bunch actually, as follows:
    Code:
    Public Declare Function GetDiskFreeSpace _
                   Lib "kernel32" _
                   Alias "GetDiskFreeSpaceA" _
                   (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, _
                   lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, _
                   lpTotalNumberOfClusters As Long) As Long
    
    Public Declare Function GetDriveType _
                   Lib "kernel32" _
                   Alias "GetDriveTypeA" _
                   (ByVal nDrive As String) As Long
    
    Public Declare Function GetLogicalDriveStrings _
                   Lib "kernel32" _
                   Alias "GetLogicalDriveStringsA" _
                   (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
    
    Public Declare Function GetVolumeInformation _
                   Lib "kernel32" _
                   Alias "GetVolumeInformationA" _
                   (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, _
                   ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _
                   lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
                   ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) _
                   As Long
    
    Public Declare Function QueryDosDevice _
                   Lib "kernel32" _
                   Alias "QueryDosDeviceA" _
                   (ByVal lpDeviceName As String, ByVal lpTargetPath As String, _
                   ByVal ucchMax As Long) As Long
    I may be missing some, but these are the main ones.
    Hope it helps.

  3. #3
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217

    Wink

    Whoops, I knew I was forgetting one (at least). Here's the one to set the name of the drive:
    Code:
    Public Declare Function SetVolumeLabel _
                   Lib "kernel32" _
                   Alias "SetVolumeLabelA" _
                   (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Long
    If I remember any more I'll post them to
    Later.

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