home *** CD-ROM | disk | FTP | other *** search
- Dim Pi As Double
- Dim Regs As Registers
- Dim DriveNum As Integer
-
- Sub TheDrive_Change ()
- Update_Caption
- End Sub
-
- Sub Update_Caption ()
- D$ = TheDrive.Drive
- Caption = UpCase(D$) + ":"
- DriveNum = Asc(Caption) - 64
- End Sub
-
- Function UpCase (ByVal A$) As String
- S% = Asc(A$)
- If S% >= 97 And S% <= 122 Then S% = S% - 32
- UpCase = Chr$(S%)
- End Function
-
- Sub Form_Load ()
- FillStyle = Solid
- Pi = 4 * Atn(1)
- Update_Caption
- End Sub
-
- Sub TheTimer_Timer ()
- Update_Display
- End Sub
-
- Sub Update_Display ()
- If WindowState = 1 Then
- Scale (-16, 7)-(16, -1)
- Else
- Scale (-20, 8)-(20, -4)
- End If
- Regs.AX = &H3600
- Regs.DX = DriveNum
- Regs.DS = 0 ' Insurance against GP faults
- Regs.ES = 0
- MsDos Regs
- If Regs.AX = -1 Then Regs.DX = 0 'Use Regs.DX=0 to flag error
- If Regs.DX = 0 Then 'Avoid division by zero
- Fraction = 0
- Else
- Clusters& = Regs.DX
- FreeClusters& = Regs.BX
- If Clusters& < 0 Then Clusters& = Clusters& + 65536
- If FreeClusters& < 0 Then FreeClusters& = FreeClusters& + 65536
- Fraction = FreeClusters& / Clusters&
- End If
- Angle = Pi * Fraction 'The more free space, the larger Angle gets
- If Angle = 0 Then Angle = .01!
- If Angle < Pi Then
- FillColor = RED
- Circle (0, 0), 12, Black, -Angle, -Pi 'Draw from Angle to Pi
- End If
- If Angle > .1! Then
- FillColor = WHITE
- Circle (0, 0), 12, Black, -1E-32, -Angle
- End If
- If WindowState = 0 Then
- CurrentY = 3
- Else
- CurrentY = 6
- End If
-
- If Regs.DX <> 0 Then
- Legend$ = Format$(Fraction, "##0%")
- If WindowState = 0 Then Legend$ = Legend$ + " Free"
- Else
- Legend$ = "Error"
- End If
- CurrentX = -TextWidth(Legend$) / 2
- Print Legend$;
- If WindowState = 0 Then
- Legend$ = Format$((CDbl(FreeClusters&) * Regs.AX) * Regs.CX, "#,###,###,###,###") + " Bytes"
- Print
- CurrentX = -TextWidth(Legend$) / 2
- Print Legend$;
- End If
- End Sub
-
- Sub Form_Paint ()
- Update_Display
- End Sub
-
- Sub Interval_KeyPress (KeyAscii As Integer)
- Select Case KeyAscii
- Case 13
- KeyAscii = 0
- Reset_Timer
- TheDrive.SetFocus
- Exit Sub
- Case 8
- Exit Sub
- Case Asc("0") To Asc("9")
- If Len(Interval.Text) < 2 Then Exit Sub
- End Select
- KeyAscii = 0
- Beep
- End Sub
-
- Sub Interval_LostFocus ()
- Reset_Timer
- End Sub
-
- Sub Reset_Timer ()
- Interval.Text = LTrim$(RTrim$(Interval.Text))
- If Len(Interval.Text) <> 0 Then
- NewInterval = Val(Interval.Text) * 1000
- If NewInterval <> 0 Then
- If NewInterval <> TheTimer.Interval Then
- TheTimer.Interval = Val(Interval.Text) * 1000
- End If
- End If
- End If
- Interval.Text = LTrim$(Str$(TheTimer.Interval / 1000))
- End Sub
-
-