home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 4.00 Begin VB.Form frmDisk Caption = "Disk Analyzer" ClientHeight = 2790 ClientLeft = 1095 ClientTop = 1515 ClientWidth = 4215 Height = 3195 Left = 1035 LinkTopic = "Form1" ScaleHeight = 2790 ScaleWidth = 4215 Top = 1170 Width = 4335 Begin VB.DriveListBox Drive1 Height = 315 Left = 120 TabIndex = 0 Top = 180 Width = 3975 End Begin VB.Label lblPercent BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 14 Top = 2340 Width = 1935 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Percent Free:" Height = 255 Index = 6 Left = 120 TabIndex = 13 Top = 2400 Width = 1995 End Begin VB.Label lblTotalBytes BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 12 Top = 2040 Width = 1935 End Begin VB.Label lblTotalFree BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 11 Top = 1740 Width = 1935 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Total Bytes:" Height = 255 Index = 5 Left = 120 TabIndex = 10 Top = 2100 Width = 1995 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Total free Bytes:" Height = 255 Index = 4 Left = 120 TabIndex = 9 Top = 1800 Width = 1995 End Begin VB.Label lblClusters BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 8 Top = 1440 Width = 1935 End Begin VB.Label lblFree BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 7 Top = 1140 Width = 1935 End Begin VB.Label lblBytes BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 6 Top = 840 Width = 1935 End Begin VB.Label lblSectors BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Height = 315 Left = 2160 TabIndex = 5 Top = 540 Width = 1935 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Total number of clustors:" Height = 255 Index = 3 Left = 120 TabIndex = 4 Top = 1500 Width = 1995 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Number of free clusters:" Height = 255 Index = 2 Left = 120 TabIndex = 3 Top = 1200 Width = 1995 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Bytes per sector:" Height = 255 Index = 1 Left = 120 TabIndex = 2 Top = 900 Width = 1995 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "Sectors per cluster:" Height = 255 Index = 0 Left = 120 TabIndex = 1 Top = 600 Width = 1995 End Attribute VB_Name = "frmDisk" Attribute VB_Creatable = False Attribute VB_Exposed = False Option Explicit ' Copyright 1997 by Desaware Inc. All Rights Reserved Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long Dim SectorsPerCluster&, BytesPerSector&, NumberOfFreeClustors&, TotalNumberOfClustors& Dim BytesFree&, BytesTotal& Dim PercentFree& Private Sub Drive1_Change() DisplayResults End Sub Public Sub DisplayResults() Dim dl& Dim s$ Dim spaceloc% Dim FreeBytes&, TotalBytes& s$ = Drive1.Drive ' Is there a space? Strip off the volume name if so spaceloc = InStr(s$, " ") If spaceloc > 0 Then s$ = Left$(s$, spaceloc - 1) End If If Right$(s$, 1) <> "\" Then s$ = s$ & "\" dl& = GetDiskFreeSpace(s$, SectorsPerCluster, BytesPerSector, NumberOfFreeClustors, TotalNumberOfClustors) lblSectors = Format(SectorsPerCluster, "#,0") lblBytes = Format(BytesPerSector, "#,0") lblFree = Format(NumberOfFreeClustors, "#,0") lblClusters = Format(TotalNumberOfClustors, "#,0") TotalBytes = TotalNumberOfClustors * SectorsPerCluster * BytesPerSector lblTotalBytes = Format(TotalBytes, "#,0") FreeBytes = NumberOfFreeClustors * SectorsPerCluster * BytesPerSector lblTotalFree = Format(FreeBytes, "#,0") lblPercent = Format(FreeBytes / TotalBytes, "Percent") End Sub Private Sub Form_Load() DisplayResults End Sub