Make your own free website on Tripod.com
Get The Name Of The File System (e.g. FAT)

Module Code

Declare Function GetVolumeInformation Lib _
   "kernel32.dll" Alias "GetVolumeInformationA" _
   (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, _
   ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, _
   lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
   ByVal lpFileSystemNameBuffer As String, _
   ByVal nFileSystemNameSize As Long) As Long

Form Code

Public Function FileSystem(ByVal Drive As String) As String
   
    Dim lAns As Long
    Dim lRet As Long
    Dim sVolumeName As String, sDriveType As String
    Dim sDrive As String
    Dim iPos As Integer
   
    sDrive = Drive
    If Len(sDrive) = 1 Then
        sDrive = sDrive & ":\"
    ElseIf Len(sDrive) = 2 And Right(sDrive, 1) = ":" Then
        sDrive = sDrive & "\"
    End If
 
    sVolumeName = String$(255, Chr$(0))
    sDriveType = String$(255, Chr$(0))
   
    lRet = GetVolumeInformation(sDrive, sVolumeName, _
    255, lAns, 0, 0, sDriveType, 255)
    iPos = InStr(sDriveType, Chr$(0))
    If iPos > 0 Then sDriveType = Left(sDriveType, iPos - 1)
   
    FileSystem = sDriveType
End Function


Private Sub Form_Load()
    MsgBox "The file system of drive c: is: " & FileSystem("c:")
End Sub

Go Back