home *** CD-ROM | disk | FTP | other *** search
- DISKINFO.DLL
-
- This DLL is provided as a service to all VB users who may find it
- useful. If you choose to use this DLL then you do so at your own
- risk, however, I have been using it constantly in all my VB3 apps
- and have never had a problem so far.
-
- This DLL will work with Visual Basic.
- This DLL is the compiled version of the DLL found in the help file
- article Q106553 (refer to this article for more info).
-
- There is an error in the code found in the help file. I have modified
- the code to correct that error. The line of code in question is:
-
- *ulFreeSpace - (unsigned long) driveinfo.avail_clusters ...etc
-
- The first minus sign should have been an equal sign as such:
-
- *ulFreeSpace = (unsigned long) ...etc
-
- This DLL was compiled using MSVC++ 1.0
-
- This DLL will return the free disk space of the current drive. If you
- require to know the free disk space of a drive which is not the current
- drive then you must change drives using the VB commands CurDir and ChDrive.
- If you save the current drive before you change drives you can use these
- commands to ensure that you return to the desired drive before you exit
- the procedure that called this sub.
-
- Assuming you have installed the DLL into the Windows\System directory,
- the declaration for the sub is such (type all on one line):
-
- Declare Sub GetDiskInfo lib "diskinfo.dll" (ByVal mydrive$,
- ByVal myvolume$, free&)
-
- Notice that there is no 'ByVal' used with free.
-
- Here is an example of calling the DLL:
-
- Sub cmdDiskSpace_ Click()
- Dim drive As String * 1
- Dim volume As String * 20
- Dim free&
- Call GetDiskInfo(drive, volume, free&)
- End Sub
-
- Within the sub you could add code to use the returned variables as required.
-
- 'drive' will return the current drive.
-
- 'volume' will return the volume of the drive.
-
- 'free' will return the available free disk space.
-
- What you must take into consideration when using 'free' is that the
- DLL returns an unsigned long, which is not available within VB.
- Therefore, if the free disk space is larger than the VB maximum size
- for a long (2,147,483,647) it will return a negative value. For example,
- this code seems to check for free disk space over 100000:
-
- If free > 100000 Then
- ...etc
- End If
-
- This code will take into consideration the negative values:
-
- If free < 0 And free > 100000 Then
- ...etc
- End If
-
- This DLL is submitted by Douglas Marquardt, 72253,3113
- A more detailed explanation can be found in the KB article Q106553.
-