home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / odo_src / dskspace.txt < prev    next >
Text File  |  1992-08-14  |  1KB  |  37 lines

  1. Here is the DLL, DiskInfo.DLL. It contains one function, also called
  2. DiskInfo. The declaration is as follows:-
  3.  
  4. Declare Function DiskInfo Lib "DiskInfo.DLL" (ByVal DriveNum%,
  5. ByVal DriveInfo%) As Long
  6.  
  7. DriveNum% is the drive that you want the figures for: 0=Default
  8. Drive, 1=drive A, 2=B, 3=C etc.
  9.  
  10. DriveInfo% is the information you want: 1 = Free Space, 2 = Total 
  11. Space, 3 = Total Clusters, 4 = Available Clusters, 5 = Sectors per 
  12. Cluster, 6 = Bytes per Sector.
  13.  
  14. If you pass an incorrect DriveNum%, the function returns -1, if
  15. there is an error related to DriveInfo% it returns -2. Otherwise
  16. it returns either a number (of clusters/sectors) or a number of Bytes.
  17.  
  18. **********
  19.  
  20. I have added another two functions, to return the free system 
  21. resources and the free memory.
  22.  
  23. Declare Function GetFreeMem Lib "DiskInfo.DLL" () As Long
  24. ' returns the amount of free system memory in bytes
  25.  
  26. Declare Function GetFreeRes Lib "DiskInfo.DLL" ( ByVal InfoType% ) 
  27. As Integer
  28. ' returns a number between 0-100, which is the percentage of free 
  29. 'resources of the type specified in InfoType%. 0 = System Resources,
  30. '1 = GDI Resources, 2 = User Resources. It will return -1 if you 
  31. 'specify an incorrect type.
  32.  
  33. I have included a tiny VB app called DiskInf which very quickly 
  34. demonstrates the three functions.
  35.  
  36. Ian Taylor
  37. 100025,557