CodeItBetter Programming Another VB Programming Blog

How to get Volume label, Serial Number and File system of a given drive name

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'System & API - How to get Volume label, Serial Number and File system of a given drive name
Option Explicit
 
Private 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
 
Private Sub Main()
    Dim lDrvSerialNo As Long
    Dim sDrvLbl As String * 256
    Dim sFileSys As String * 256
    Dim I As Long
    Dim J As Long
    Dim X As Long
    X = GetVolumeInformation("C:\", sDrvLbl, 256, lDrvSerialNo, I, J, sFileSys, 256)
    Debug.Print "Label of C Drive is  " & sDrvLbl
    Debug.Print "It's serial number = " & Hex(lDrvSerialNo)
    Debug.Print "FileSystem = " & sFileSys
End Sub

Related posts:

  1. How to get the USB’s Serial Number
  2. How to Return Volume Name for given Drive letter
  3. How to Return a volume’s serial number
  4. How to Get Floppy/CD/Hard Drive Serial Number
  5. How to check whether the file system is FAT 32 or NTFS
  6. How to check whether CD/Floppy Disk is in the Drive
  7. How to Set Volume Name for given Drive letter
  8. How to list down all necessary Drive information
  9. How to find Mother boad Serial Number
  10. How to get the file path for the selected file using Common Dialog control

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.