getting volume serial number

How do you get this info with Xojo for Windows ?

If you have the MBS Plugins, you can use the example “Volume Information”

dim w as WindowsVolumeInformationMBS
w=new WindowsVolumeInformationMBS(“C:”)

The logical or physical one?

  1. The one that’s created when burning a cd or flash USB (I guess it’s the logical).

  2. A way without plugins ?


This may help…

Sorry - I’ll try again…

LInk to older thread

This should work by using OLEObject:


Sub ShowDriveType(drvpath As String) // drvpath is “C:” or “D:”

// Info: Serial number

// Returns a value indicating the type of a specified drive.

Dim fs As OLEObject
Dim d As OLEObject
Dim s, t As String
Dim sn as uint32

fs = New OLEObject(“Scripting.FileSystemObject”)
d = fs.GetDrive(drvpath)

If d.IsReady Then //Returns True if the specified drive is ready;

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

// d.SerialNumber Returns the decimal serial number used to uniquely identify a disk volume
sn = d.SerialNumber

s = "Drive " + d.DriveLetter + ": - " + t +EndOfLine + "Serial No: " +Hex(sn)
MsgBox s

End If

fs = Nil

exception err as oleexception
msgbox err.message
End Sub[/code]

To confirm the above code shows the correct serial number for disk volume. You can use the windows command: vol

Example: C:\\vol c: Volume in drive C has no label. Volume Serial Number is 74E2-AB7A