Jumping off from here, I want to re-visit this.
I think this would be a good time to look at MBS for a solution (bought it a while ago but haven’t used it yet!)
For those that don’t want to look at the above link, I would like to be able to determine, cross-platform (Win/MacOS, maybe Linux later), whether an externally mounted SD card is the one I’m looking for.
On Mac it wasn’t too hard (diskutil info), using and even on Window 7 I had a WMIC call that seemed to work, but not so much on Win10! The info I need to confirm is whether a volume is:
So, instead of re-inventing the wheel, I wanna use my MBS stuff to try and do this. I’d also like to have automatic USB insert detection.
Having never used MBS, which USB library should I be using, or is it a different library since it’s not a HID device that I’m looking for.
That doesn’t give enough info. I was using a WMIC call, but the volume # on Win10 doesn’t match the Xojo Volume Index. It seemed to on Win7 though…
IsExternalVolume(v As Integer) As FolderItem
Dim sh As New Shell
Dim InfoStr() As String
Dim InfoStart, InfoEnd As Integer
Dim InfoVal(2) As String
Dim InfoResult(2) As String
Dim f As FolderItem = Volume(v)
#If TargetMacOS Then
sh.Execute("diskutil info " + f.ShellPath)
InfoStr = Array("Protocol:", "Device Location:", "Removable Media:")
InfoResult = Array("USB", "External", "Removable")
#ElseIf TargetWindows Then
sh.Execute("wmic diskdrive where (index=" + Str(v+1) + ") get index, InterfaceType, MediaType, Model /Format:List")
InfoStr = Array("InterfaceType=", "MediaType=")
InfoResult = Array("USB", "Removable Media")
If sh.ErrorCode = 0 Then
System.DebugLog("Checking Volume: " + f.ShellPath)
Dim shResult() As String = sh.Result.Split(EndOfLine)
For i As Integer = 0 To shResult.UBound
For j As Integer = 0 To InfoStr.UBound
InfoStart = shResult(i).InStr(InfoStr(j))
If InfoStart > 0 Then
InfoEnd = shResult(i).InStr(InfoStart, Right(InfoStr(j), 1)) + 1
InfoVal(j) = shResult(i).Mid(InfoEnd).Trim
'System.DebugLog(Str(i) + ": " + InfoStr(j) + "'" + InfoVal(j) + "'")
If InfoVal(j) <> InfoResult(j) Then Return Nil
If InfoVal(0) = "" Then Return Nil
Ok. Do you have a function that gives more information on Windows than GetDriveTypeMBS?
Also, any suggestions on how to get the correct index # that matches the volume? Not sure why my wmic index is different than Xojo’s volume index…
Only enough to get by
If only it didnt require COM to get access to it without having to poke at a shell
I’d guess Xojo is use a different API, probably a Win32 one instead of WMI, and thats why the indexes would not match up
But thats just a guess