home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmDiskSpace
- Caption = "Form1"
- ClientHeight = 675
- ClientLeft = 1140
- ClientTop = 1515
- ClientWidth = 3060
- Height = 1080
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 675
- ScaleWidth = 3060
- Top = 1170
- Width = 3180
- Begin VB.CommandButton Command1
- Caption = "Get Free DiskSpace"
- Height = 435
- Left = 105
- TabIndex = 0
- Top = 105
- Width = 2850
- End
- Attribute VB_Name = "frmDiskSpace"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- #If Win32 Then
- Private Declare Function DiskSpaceFree Lib "STKIT432.DLL" Alias _
- "DISKSPACEFREE" () As Long
- #Else
- Private Declare Function DiskSpaceFree Lib "STKIT416.DLL" () _
- As Long
- #End If
- '*************************************************************
- ' Get the disk space free for a specific drive
- '*************************************************************
- Public Function GetDiskSpaceFree(sDrive As String)
- Dim res As Long
- On Error Resume Next
- '*********************************************************
- ' Change to the drive that you wish to check.
- '*********************************************************
- ChDrive sDrive
- res = DiskSpaceFree()
- '*********************************************************
- ' If STKIT4*.DLL or drive can't be found, then return -1.
- '*********************************************************
- GetDiskSpaceFree = IIf(Err, -1, Format(res, _
- "###,###,###,##0"))
- End Function
- '*************************************************************
- ' Get the disk space free for the current drive
- '*************************************************************
- Private Sub Command1_Click()
- Caption = GetDiskSpaceFree(Left(CurDir, 1))
- End Sub
-