vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
sevAniGif - als kostenlose Vollversion auf unserer vb@rchiv CD Vol.5  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Fortgeschrittene Programmierung
Re: filesystemobject --> andere Lösung Teil 1 
Autor: T.i.m.
Datum: 30.03.05 18:06

 
Hallo Ewok,
stimmt das gleiche Problem hatte ich auch.
verwende lieber mal folgendes (PS: dieser Code ist sofort Fertig und muss nicht erst die gesammte Festplatte durchlaufen!)

In eine Form:
Option Explicit
 
Private Sub Form_Load()
    Dim bDriveExist As Boolean
    Dim sPath As String
    Dim dTotalSpace As Double
    Dim dFreeSpace As Double
    Dim dUsedSpace As Double
 
    sPath = "C"
 
    bDriveExist = Get_Disk_Space(sPath, dTotalSpace, dFreeSpace, dUsedSpace)
 
    If bDriveExist = True Then
        MsgBox "Festplattengröße von " & sPath & ": ist " & dTotalSpace & "" & _
          "Bytes" & vbCrLf & _
            "Noch Freier Speicher " & dFreeSpace & " Bytes" & vbCrLf & _
            "zur Zeit verwendet " & dUsedSpace & " Bytes"
    Else
        MsgBox "Fehler"
    End If
End Sub
Ins Modul:
Option Explicit
 
' ---------------------------------------------------------------------------
' Needed to determine space requirements of a drive
' ---------------------------------------------------------------------------
  ' Do we have the ability to use GetDiskFreeSpaceEx
  Private Declare Function LoadLibrary Lib "kernel32" _
          Alias "LoadLibraryA" _
          (ByVal lpLibFileName As String) As Long
 
  ' Verify the proceedure address within the kernel32 dll
  Private Declare Function GetProcAddress Lib "kernel32" _
          (ByVal hModule As Long, ByVal lpProcName As String) As Long
 
  ' Decrement the DLL counter when we are finished.  This is
  ' our safety net.
  Private Declare Function FreeLibrary Lib "kernel32" _
          (ByVal hLibModule As Long) As Long
 
  ' Drives over 2GB (2,147,483,647 bytes)
  Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" _
          Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, _
          FreeBytesAvailableToCaller As Currency, _
          TotalNumberOfBytes As Currency, _
          TotalNumberOfFreeBytes As Currency) As Long
 
  ' Drives under 2GB (2,147,483,647 bytes)
  Private Declare Function GetDiskFreeSpace Lib "kernel32" _
          Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _
          lpSectorsPerCluster As Long, lpBytesPerSector As Long, _
          lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As _
          Long
 
 
Public Function Get_Disk_Space(ByVal strPath As String, _
                               dblTotalSpace As Double, _
                               dblFreeSpace As Double, _
                               dblUsedSpace As Double) As Boolean
 
' ***************************************************************************
' Routine:       Get_Disk_Space
'
' Description:   Get the total number of bytes, total number of free bytes,
'                and total number of used bytes on a hard drive.  This  will
'                also determine which API call to make based on the size of
'                the drive.
'
' Parameters:    strDriveLtr   - drive to be queried (ex:  C:)
'                dblTotalSpace - Value to be returned
'                dblFreeSpace  - Value to be returned
'                dblUsedSpace  - Value to be returned
'
' Returns:       Total number of bytes, total number of free bytes, and total
'                number of used bytes on a drive.
'
' ===========================================================================
'    DATE      NAME             DESCRIPTION
' -----------  ---------------  ---------------------------------------------
' 03-MAR-2000  Kenneth Ives     Wrote routine
' 14-MAR-2000  Kenneth Ives     Modified and documented to handle under and
'                               over 2gb drives
' ***************************************************************************

*greetz*
Tim
.
http://www.DotNetWorld.de

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
filesystemobject --> Permission denied869Ewok30.03.05 14:23
Re: filesystemobject --> andere Lösung Teil 1547T.i.m.30.03.05 18:06
Re: filesystemobject --> andre Lösung Teil 2559T.i.m.30.03.05 18:07
Re: filesystemobject --> andere Lösung Teil 3577T.i.m.30.03.05 18:08

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel