Para la unidades "discos removibles" proba con este code (estoy con Windows seven y no puedo probar mucho en XP)
Agregá un combobox
Agregá un combobox
Código [Seleccionar]
Option Explicit
Private Declare Function GetLogicalDrives Lib "Kernel32" () As Long
Private Declare Function GetDriveType Lib "Kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function GetDiskFreeSpaceEx Lib "Kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
Dim LDs As Long, Cnt As Long, sDrives As String
Dim lpFreeBytesAvailableToCaller As Currency, TotalBytes As Currency, FreeBytes As Currency
Dim sistemaArchivos As String: sistemaArchivos = String$(255, Chr$(0))
Dim volumen As String: volumen = String$(255, Chr$(0))
Dim Nserie As Long
LDs = GetLogicalDrives
For Cnt = 0 To 25
If (LDs And 2 ^ Cnt) <> 0 Then
If GetDriveType(Chr$(65 + Cnt) + ":\") = 2 Then
sDrives = sDrives + " " + Chr$(65 + Cnt)
'MsgBox GetDriveType(Chr$(65 + Cnt) + ":\")
End If
End If
Next Cnt
'MsgBox Trim(sDrives)
Dim ssDrives() As String
ssDrives() = Split(Trim(sDrives), " ")
'MsgBox ssDrives(0)
'MsgBox ssDrives(1)
'MsgBox UBound(ssDrives)
If UBound(ssDrives) < 0 Then
MsgBox "No hay Ubidades extraibles"
'End 'Exit Sub
End If
Dim i As Long
For i = 0 To UBound(ssDrives)
Call GetDiskFreeSpaceEx(ssDrives(i) + ":\", lpFreeBytesAvailableToCaller, TotalBytes, FreeBytes)
Call GetVolumeInformation(ssDrives(i) + ":\", volumen, Len(volumen), Nserie, 0, 0, sistemaArchivos, Len(sistemaArchivos))
'MsgBox ssDrives(i) + ":\" & vbTab & Format(TotalBytes / 102400, "0.00") & " GB"
Combo1.AddItem (ssDrives(i) + ":\" & " " & Format(TotalBytes / 102400, "0.00") & " GB") & " " & Trim(volumen)
Next i
If Combo1.ListCount > 0 Then Combo1.ListIndex = 0
End Sub