home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Begin VB.Form frmExperiment Caption = "Windows Update" ClientHeight = 2010 ClientLeft = 60 ClientTop = 345 ClientWidth = 7530 LinkTopic = "Form1" ScaleHeight = 129.782 ScaleMode = 0 'User ScaleWidth = 502 StartUpPosition = 3 'Windows Default Begin VB.Timer Timer2 Enabled = 0 'False Interval = 2000 Left = 6240 Top = 120 End Begin VB.Timer Timer1 Enabled = 0 'False Interval = 125 Left = 6000 Top = 360 End Begin VB.CommandButton cmdQuit Caption = "&Cancel" Height = 495 Left = 5880 TabIndex = 3 Top = 1440 Width = 1575 End Begin VB.CommandButton cmdRun Caption = "&Download" Height = 495 Left = 120 TabIndex = 2 Top = 1440 Width = 1575 End Begin VB.PictureBox picBar Appearance = 0 'Flat BackColor = &H80000005& ForeColor = &H80000008& Height = 480 Left = 120 ScaleHeight = 30 ScaleMode = 3 'Pixel ScaleWidth = 447 TabIndex = 0 Top = 840 Width = 6735 End Begin VB.Label Label3 Alignment = 2 'Center Caption = "%" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 6840 TabIndex = 7 Top = 558 Width = 615 End Begin VB.Label lblEstimate Height = 255 Left = 1800 TabIndex = 6 Top = 1560 Width = 3975 End Begin VB.Label Label2 Alignment = 2 'Center Caption = "Download Windows 2000 Official?" BeginProperty Font Name = "Tahoma" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 120 TabIndex = 5 Top = 120 Width = 7335 End Begin VB.Label lblPercent Alignment = 2 'Center BackColor = &H80000001& BorderStyle = 1 'Fixed Single ForeColor = &H8000000E& Height = 495 Left = 6840 TabIndex = 4 Top = 840 Width = 615 End Begin VB.Label Label1 Caption = "Progress:" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 120 TabIndex = 1 Top = 600 Width = 855 End Attribute VB_Name = "frmExperiment" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim NumProgBarPixels As Long Dim CurrentNumProgBarPixels As Long Dim TimerRunning As Boolean Private Const FormHeightSmall = 133 Private Const FormHeightBig = 463 Private Const ButtonTopSmall = 96 Private Const ButtonTopBig = 426 Private Const ProgressHeightSmall = 31 Private Const ProgressHeightBig = 325 Dim StepAmount As Long Dim Est As Long Option Explicit Private Sub cmdQuit_Click() End End Sub Sub cmdRun_Click() Dim i As Integer 'First change the form For i = FormHeightSmall To FormHeightBig Step 5 frmExperiment.Height = (i * Screen.TwipsPerPixelY) Next i For i = ProgressHeightSmall To ProgressHeightBig Step 5 picBar.Height = i '(i * Screen.TwipsPerPixelY) Next i cmdRun.Top = (frmExperiment.ScaleHeight - cmdRun.Height) - 5 cmdQuit.Top = (frmExperiment.ScaleHeight - cmdQuit.Height) - 5 lblEstimate.Top = cmdRun.Top + 5 Timer1.Enabled = True TimerRunning = True picBar.Cls cmdRun.Enabled = False cmdQuit.Enabled = False Timer2.Enabled = True End Sub Private Sub Form_Load() Randomize Timer NumProgBarPixels = picBar.Width * picBar.Height 'sldPixels.Max = (Int(NumProgBarPixels / 2)) CurrentNumProgBarPixels = 0 'lblSliderValue = 10 StepAmount = 1 SetPixel picBar.hdc, 1, 1, RGB(0, 0, 0) Est = Rnd * 500000000# End Sub Private Sub Timer1_Timer() Dim timevar As Double Dim retval As Variant CurrentNumProgBarPixels = CurrentNumProgBarPixels + StepAmount timevar = (Int((CurrentNumProgBarPixels / (NumProgBarPixels + 1)) * 100000) / 1000&) lblPercent.Caption = Format(timevar) + "%" If timevar > 5 Then retval = MsgBox("Error downloading." + vbCr + "A new version of windows has become available." + vbCr + "Press OK to download it now.", vbInformation + vbOKOnly, "Windows Update") CurrentNumProgBarPixels = 0 timevar = 0 picBar.Cls End If Call DrawPixels End Sub Sub DrawPixels() Dim i As Long Dim x As Long Dim y As Long If CurrentNumProgBarPixels > NumProgBarPixels Then CurrentNumProgBarPixels = 0 picBar.Cls Exit Sub End If If StepAmount > 1 Then For i = (CurrentNumProgBarPixels - StepAmount) To CurrentNumProgBarPixels x = Int(i / picBar.Height) y = i - (x * picBar.Height) SetPixel picBar.hdc, x, y, RGB(0, 0, 0) Next i Else x = Int(CurrentNumProgBarPixels / picBar.Height) y = CurrentNumProgBarPixels - (x * picBar.Height) SetPixel picBar.hdc, x, y, RGB(0, 0, 0) End If End Sub Private Sub Timer2_Timer() lblEstimate.Caption = "Estimated Time Left: " + Format(Est) + " Hours." End Sub