Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disk Size

Status
Not open for further replies.

KTAU95

Programmer
Apr 15, 2003
2
US
How do I determine the size of a disk using VB?
 
Using FSO. This has been answered before.
Do a keyword - all words, any date - search using
FSO Drive Size
 
The GetDiskFreeSpace API.
___

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
Private Sub Form_Load()
Dim A As Long, B As Long, C As Long, D As Long
Dim Total As Double, Free As Double
GetDiskFreeSpace "C:\", A, B, C, D
Total = 1# * A * B * D
Free = 1# * A * B * C
MsgBox "Total = " & Total & " bytes" & vbLf & _
"Free = " & Free & " bytes", , "C:\"
End
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top