la codeteca
Compartir:

Analizar Disco Duro

Esta parte va en un modulo:
' --------- MODULO
Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector _
As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Esta en el formulario del programa
' --------- FORMULARIO
Private Sub Form_Load()
result = GetDiskFreeSpace("c:\", lspc, lbps, lnofc, ltnoc)
If result = 0 Then MsgBox "Ocurrió un error!"
MyCapacity = lspc * lbps * ltnoc
MyFree = lspc * lbps * lnofc
MyUsed = MyCapacity - MyFree
MsgBox "Capacidad: " & MyCapacity & " Bytes"
MsgBox "Libre: " & MyFree & " Bytes"
MsgBox "Usado: " & MyUsed & " Bytes"
End Sub