Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    determinare spazio libero con Drivelistbox

    Come determinare lo spazio libero su un Hd con l'evento change
    di un drivelistbox?
    Grazie

  2. #2

    re

    nessuno sa?
    Un aiuto per Favore sono all'inizio e mi sono imbattuto in questo problema.
    Grazie

  3. #3

    re

    nessuno sa?
    Un aiuto per Favore sono all'inizio e mi sono imbattuto in questo problema.
    Grazie

  4. #4

    re

    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>

  5. #5
    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

  6. #6
    Scusami Xegallo

  7. #7
    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

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.