vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Top-Preis! AP-Access-Tools-CD Volume 1  
 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 3 
Autor: T.i.m.
Datum: 30.03.05 18:08

          ' Just to be safe, decrement Dll's usage counter.
          FreeLibrary lngHandle
 
          ' If we were successful, then multiply the results
          ' by 10000 to move the decimal to the right 4 positions
          If lngRetCode Then
              ' Calculate size of the hard drive
              dblTotalSpace = CDbl(curTotalBytes * 10000)
              ' Calculate the amount of free space
              dblFreeSpace = CDbl(curTotalFreeBytes * 10000)
              ' Calculate the amount of used space
              dblUsedSpace = dblTotalSpace - dblFreeSpace
          End If
      End If
 
      ' Just to be safe, decrement Dll's usage counter.
      FreeLibrary lngHandle
  End If
 
' ---------------------------------------------------------------------------
' If an error brought us to here then make sure we reset all variables
' ---------------------------------------------------------------------------
Over_2gb_Not_Supported:
  If Err.Number <> 0 Then
      Err.Clear           ' reset error code
      dblTotalSpace = 0   ' empty variables
      dblFreeSpace = 0
      dblUsedSpace = 0
      lngRetCode = 0
  End If
 
  On Error GoTo 0
  On Error GoTo Get_Disk_Space_Errors
' ---------------------------------------------------------------------------
' If this drive is less than 2GB in total size then reset values and make
' the correct API call.
' ---------------------------------------------------------------------------
  If dblTotalSpace <= TWO_GB Then
      dblTotalSpace = 0
      dblFreeSpace = 0
      dblUsedSpace = 0
      lngRetCode = 0
  Else
      Get_Disk_Space = True
      Exit Function
  End If
 
' ---------------------------------------------------------------------------
' if we get here, GetDiskFreeSpaceEx isn't available or raised an error or
' the drive is less than 2GB in size.
' ---------------------------------------------------------------------------
  lngRetCode = GetDiskFreeSpace(strDriveLtr, lngSectorsPerCluster, _
                                lngBytesPerSector, lngNumberOfFreeClusters, _
                                lngTotalNumberOfClusters)
 
' ---------------------------------------------------------------------------
' Test the return code to see if we had a successful call
' ---------------------------------------------------------------------------
  If lngRetCode Then
      ' Calculate size of the hard drive
      dblFreeSpace = CDbl(lngNumberOfFreeClusters * lngSectorsPerCluster * _
                          lngBytesPerSector)
      ' Calculate the amount of free space
      dblTotalSpace = CDbl(lngTotalNumberOfClusters * lngSectorsPerCluster * _
                          lngBytesPerSector)
      ' Calculate the amount of used space
      dblUsedSpace = dblTotalSpace - dblFreeSpace
      Get_Disk_Space = True
  Else
      Get_Disk_Space = False
  End If
 
Normal_Exit:
  Exit Function
 
Get_Disk_Space_Errors:
  Get_Disk_Space = False
  Resume Normal_Exit
 
End Function

*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 3578T.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