Come determinare lo spazio libero su un Hd con l'evento change
di un drivelistbox?
Grazie
Come determinare lo spazio libero su un Hd con l'evento change
di un drivelistbox?
Grazie
nessuno sa?
Un aiuto per Favore sono all'inizio e mi sono imbattuto in questo problema.
Grazie
nessuno sa?
Un aiuto per Favore sono all'inizio e mi sono imbattuto in questo problema.
Grazie
Ho trovato la soluzione
se puo' servire a qualcuno ecco il codice:
in un modulo di Classe sysInfo.cls
<code>
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, ByRef lpSectorPerCluster As Long, ByRef lpBytesPerSector As Long, ByRef lpNumberOfFreeCluster As Long, ByRef lpTotalNumberOfCluster As Long) As Long
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, _
ByRef lpFreeBytesAvailableToCaller As Currency, _
ByRef lpTotalNumberOfBytes As Currency, _
ByRef lpTotalNumberOfFreeBytes As Currency) As Long
Public Property Get DiskFreeSpace(sDrivePath As String) As Double
Dim lNOfCluster As Long, lNOfFreeCluster As Long
Dim lBytesPerSector As Long, lSectorsPerCluster As Long
Dim cTotUserBytes As Currency, cTotBytes As Currency, cTotFreeBytes As Currency
Dim fErrore As Boolean
If Right(sDrivePath, 1) <> "\" Then sDrivePath = sDrivePath + "\"
On Error Resume Next
GetDiskFreeSpaceEx sDrivePath, cTotUserBytes, cTotBytes, cTotFreeBytes
fErrore = Err.Number <> 0
On Error GoTo 0
If fErrore Then
' La funzione non esiste: non ci troviamo su Win95 OSR2 o WinNT
If GetDiskFreeSpace(sDrivePath, lSectorsPerCluster, lBytesPerSector, lNOfFreeCluster, lNOfCluster) Then
DiskFreeSpace = lNOfFreeCluster * lSectorsPerCluster * lBytesPerSector
Else
DiskFreeSpace = 0
End If
Else
DiskFreeSpace = Format(cTotFreeBytes * 10000 / 1024 / 1024) ' Conversione dal currency
End If
End Property
Public Property Get DiskSpace(sDrivePath As String) As Double
Dim lNOfCluster As Long, lNOfFreeCluster As Long
Dim lBytesPerSector As Long, lSectorsPerCluster As Long
Dim cTotUserBytes As Currency, cTotBytes As Currency, cTotFreeBytes As Currency
Dim fErrore As Boolean
If Right(sDrivePath, 1) <> "\" Then sDrivePath = sDrivePath + "\"
On Error Resume Next
GetDiskFreeSpaceEx sDrivePath, cTotUserBytes, cTotBytes, cTotFreeBytes
fErrore = Err.Number <> 0
On Error GoTo 0
If fErrore Then
' La funzione non esiste: non ci troviamo su Win95 OSR2 o WinNT
If GetDiskFreeSpace(sDrivePath, lSectorsPerCluster, lBytesPerSector, lNOfFreeCluster, lNOfCluster) Then
DiskSpace = lNOfCluster * lSectorsPerCluster * lBytesPerSector
Else
DiskSpace = 0
End If
Else
DiskSpace = cTotBytes * 10000 ' Conversione dal currency
End If
End Property
</code>
--------------------------------------------------------------------
In un Modulo Form
<code>
Dim SysInfo As New SysInfo
Private Sub Drive1_Change()
Lbldimensione.Caption = Left(SysInfo.DiskFreeSpace(Left$(Drive1, 2)), 4) & " " & "MB"
End Sub
</code>
non è HTML non usare <> ma []
Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te
Scusami Xegallo![]()
l'altra parte della discussione continua di qua
http://forum.html.it/forum/showthrea...hreadid=455600
Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te