Is it possible to get a Volume type on Windows

I need to determine the type of a volume mounted on a Windows system - i.e.: Local Disk, CD/DVD, Network Volume, etc.

Since Volume(x).Type always returns special/folder regardless of the actual volume type, it’s pretty useless for this situation.

Windows API: GetDriveType

Using Windows Functionality Suite:

FileProcessing.GetDriveType(root As FolderItem) As String

Thanks for the info, Paul.

Hmmm, seems like that should really be a part of the Xojo FolderItem framework so that we can have a single call for all platforms.

You can also get it by using OLEObject

Sub ShowDriveType(drvpath As String)

   // Returns a value indicating the type of a specified drive.
   Dim fs As OLEObject
   Dim d As OLEObject
   Dim s, t As String
   fs = New OLEObject("Scripting.FileSystemObject")
   d = fs.GetDrive(drvpath)

If d.IsReady Then
   Select Case d.DriveType
   Case 0
      t = "Unknown"
   Case 1
      t = "Removable"
   Case 2
      t = "Fixed"
   Case 3
      t = "Network"
   Case 4
      t = "CD-ROM"
   Case 5
      t = "RAM Disk"
   End Select
   s = "Drive " + d.DriveLetter + ": - " + t
   MsgBox s

End If
    fs = Nil
 exception err as oleexception
   msgbox err.message
End Sub