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
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.