home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Disk Spaces DLL Demo"
- ClientHeight = 2505
- ClientLeft = 2160
- ClientTop = 1845
- ClientWidth = 4530
- ControlBox = 0 'False
- Height = 2910
- Left = 2100
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2505
- ScaleWidth = 4530
- Top = 1500
- Width = 4650
- Begin CommandButton Command1
- Caption = "&OK"
- Height = 525
- Left = 3510
- TabIndex = 6
- Top = 1890
- Width = 945
- End
- Begin DriveListBox Drive1
- BackColor = &H00FFFFFF&
- Height = 315
- Left = 750
- TabIndex = 4
- Top = 1260
- Width = 2415
- End
- Begin Label Label6
- BackColor = &H00C0C0C0&
- Caption = "Demo by John Castravet"
- Height = 195
- Left = 1260
- TabIndex = 7
- Top = 90
- Width = 2145
- End
- Begin Label Label5
- BackColor = &H00C0C0C0&
- Caption = "Drive:"
- Height = 195
- Left = 60
- TabIndex = 5
- Top = 1320
- Width = 675
- End
- Begin Label Label4
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 1290
- TabIndex = 3
- Top = 720
- Width = 1875
- End
- Begin Label Label3
- BackColor = &H00C0C0C0&
- Caption = "Free Space:"
- Height = 195
- Left = 60
- TabIndex = 2
- Top = 750
- Width = 1185
- End
- Begin Label Label2
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 1290
- TabIndex = 1
- Top = 390
- Width = 1875
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "Total Space:"
- Height = 195
- Left = 60
- TabIndex = 0
- Top = 420
- Width = 1185
- End
- Sub Command1_Click ()
- Unload Form1
- End Sub
- Sub Drive1_Change ()
- 'The Total and the Available disk spaces are shown in Label2 and Label4.
- 'If interested you can also use the Bytes Per Sector, Sectors Per Cluster,
- 'the total Disk Clusters and the available Disk Clusters.
- 'Use the Panel control found in THREED.VBX with the Flood property set
- 'to create a bar graph type indicator.
- Dim DiskSpace As DiskFree
- Dim Unit As Integer
- Dim dBytesCluster As Double
- Dim dTemp As Double
- Unit = Asc(Drive1.Drive) - Asc("a") + 1
- Er% = GetDiskSpaces(Unit, DiskSpace)
- If Er% = 0 Then
- dBytesCluster = DiskSpace.Bytes_Per_Sector * DiskSpace.Sectors_Per_Cluster
- dTemp = dBytesCluster * DiskSpace.Total_Clusters
- Label2.Caption = Format$(dTemp / 1024, "#,##0 KB")
- dTemp = dBytesCluster * DiskSpace.Avail_Clusters
- Label4.Caption = Format$(dTemp / 1024, "#,##0 KB")
- Else
- Label2.Caption = "Disk Error"
- Label4.Caption = "Disk Error"
- End If
- End Sub
- Sub Form_Load ()
- Drive1_Change
- End Sub
-