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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TO KNOW HOW MUCH SPACE IS IN MY DRIVE

Status
Not open for further replies.

aaaaaaaaaaaa

Programmer
Aug 4, 2001
25
IN
i WANT TO KNOW HOW MUCH SPACE IS THERE ON MY DRIVE...
CAN ANY ONE HELP
 
Hi,

It's as simple as this:

[tt]
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long

Private Sub Form_Load()
Dim Sectors As Long, Bytes As Long, FreeClusters As Long, TotalClusters As Long
'Retrieve information about drive C:
Call GetDiskFreeSpace("C:\", Sectors, Bytes, FreeClusters, TotalClusters)

MsgBox "Drive C: has " & (FreeClusters * Sectors * Bytes) & " bytes free"
End Sub
[/tt]
LuCkY
 
Hi aaaaaaaaaaaa

Here is my suggestion as an introduction.

Dim fso As New Filesystemobject, drv As Drive, s As String
Set drv = fso.GetDrive(fso.GetDriveName("c:"))
MsgBox drv.FreeSpace

This leads me onto a new subject.

As I know nothing about Windows API I feel like im missing out on something. For the rest of VB it is easy to 'play around' to get what you want. API is something different - where is all the info and little tools to make it easy?

Looking to you LuckyLuke for help, as you can make something I know into cool looking alien code.


Stew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top