Un caro saluto a tutta la lista, ho una chiavetta USB che ho chiamato MyPen, all’interno c’ un database, come sapere in che unit stata inserita la penna affinch si possa leggere il database. Path =“Mypen:\miodatabase” non va bene ma per esempio path= “J:\miodatabase” va bene
la domanda dovrebbe essere come elencare le unit disco con i relativi nomi?
Mario
Grazie Maurizio, ho provato col seguente codice
dim i as Integer
dim x as Integer
i = FolderItem.DriveCount-1
For x = 0 To i
ListBox1.AddRow FolderItem.DriveAt(x).Name
Next
ma ricevo solo le lettere dei Drive C: D: G: J:
ma non risolve il mio problema, a me serve sapere dove si trova la mia chiavetta chiamata Mypen, nella mia prova l’ho inserita nel drive J: quindi come risposta ho bisogno di sapere oltre alla lettera il nome; esempio disco locale (C:) MyPen (J:) ecc:
Mario
Aggiungi questa funzione per il nome del volume: passa come parametro FolderItem.DriveAt(x)
Function GetVolumeName(root as FolderItem) As String
Soft Declare Function GetVolumeInformationW Lib "Kernel32" ( root as WString, _
volName as Ptr, volNameSize as Integer, ByRef volSer as Integer, ByRef _
maxCompLength as Integer, ByRef sysFlags as Integer, sysName as Ptr, _
sysNameSize as Integer ) as Boolean
dim volName as new MemoryBlock( 256 )
dim sysName as new MemoryBlock( 256 )
dim volSerial, maxCompLength, sysFlags as Integer
if System.IsFunctionAvailable( "GetVolumeInformationW", "Kernel32" ) then
Call GetVolumeInformationW( left( root.nativepath , 3 ), volName, 256, volSerial, maxCompLength, _
sysFlags, sysName, 256 )
return volName.WString( 0 )
end if
Return ""
End Function
Grande Maurizio, grazieeeeeeeeeeeeeee!!!
Mario