Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Disk free space, used space.


Disk free space, used space.

Author
Message
kwandobe
kwandobe
Forum God
Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)

Group: Forum Members
Posts: 22, Visits: 4
Does anyone have any code for checking a disks free and used space? I have been unsuccessful whilst looking through my outdated win32api.txt file. Does anyone have a recent copy of this file? Thanks in advance!

-kwandobe


swi
swi
Forum God
Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)Forum God (4.1K reputation)

Group: Forum Members
Posts: 48, Visits: 3
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B225144

Swi
Keithuk
Keithuk
Forum God
Forum God (302K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K

Option Explicit

Dim Status As Long
Dim TotalBytes As Currency
Dim FreeBytes As Currency
Dim BytesAvailableToCaller As Currency
Dim DiskSize As String
Dim DiskSpace As String

Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long

Private Sub Form_Load()

Status = GetDiskFreeSpaceEx("C:", BytesAvailableToCaller, TotalBytes, FreeBytes)
If Status = 0 Then
    DiskSize = "Unknown"
    DiskSpace = "Unknown"
Else
    DiskSize = Format(TotalBytes * 10000, "#,##0") & " Bytes"
    DiskSpace = Format(FreeBytes * 10000, "#,##0") & " Bytes"
End If

MsgBox "HardDrive size = " & Disksize

MsgBox "Free DiskSpace = " & DiskSpace

End Sub



Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search