home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
odo_src
/
dskspace.txt
< prev
next >
Wrap
Text File
|
1992-08-14
|
1KB
|
37 lines
Here is the DLL, DiskInfo.DLL. It contains one function, also called
DiskInfo. The declaration is as follows:-
Declare Function DiskInfo Lib "DiskInfo.DLL" (ByVal DriveNum%,
ByVal DriveInfo%) As Long
DriveNum% is the drive that you want the figures for: 0=Default
Drive, 1=drive A, 2=B, 3=C etc.
DriveInfo% is the information you want: 1 = Free Space, 2 = Total
Space, 3 = Total Clusters, 4 = Available Clusters, 5 = Sectors per
Cluster, 6 = Bytes per Sector.
If you pass an incorrect DriveNum%, the function returns -1, if
there is an error related to DriveInfo% it returns -2. Otherwise
it returns either a number (of clusters/sectors) or a number of Bytes.
**********
I have added another two functions, to return the free system
resources and the free memory.
Declare Function GetFreeMem Lib "DiskInfo.DLL" () As Long
' returns the amount of free system memory in bytes
Declare Function GetFreeRes Lib "DiskInfo.DLL" ( ByVal InfoType% )
As Integer
' returns a number between 0-100, which is the percentage of free
'resources of the type specified in InfoType%. 0 = System Resources,
'1 = GDI Resources, 2 = User Resources. It will return -1 if you
'specify an incorrect type.
I have included a tiny VB app called DiskInf which very quickly
demonstrates the three functions.
Ian Taylor
100025,557