wadiohead
08-05-2005, 06:48 AM
I don't understand this at all, every time I use this timer procedure, it shoots up to 100% CPU Usage... even if I take pretty much EVERYTHING out of the code except the timer.
With Me
Start = Timer
Do While Timer < Start + CountDownTimer
counter = Format(CountDownTimer - (Timer - Start), "#")
DoEvents
With .lblSecondsCounter
If .Caption <> counter Then
If .Caption = "10" Then
.ForeColor = 255
Me.btnCancelAutorun.ForeColor = 255
Me.lblSeconds.ForeColor = 255
End If
pctcompleted = (Timer - Start) / CountDownTimer
UpdateProgress (pctcompleted)
.Caption = counter
End If
End With
If CancelAutoRun = True Then
RunAutomaticScript = False
.btnGenerateTable.Visible = True
.btnUpdateProdDB.Visible = True
GoTo EndGame
End If
Loop
End With
RunAutomaticScript = True
Notes:
CancelAutoRun is set to true by a button click.
UpdateProgress works with a progress bar. Disabling it does not effect CPU usage.
Endgame just does some simple exit procedure-type stuff.
Any advice would be appreciated... I'm just scratching my head here.
David
With Me
Start = Timer
Do While Timer < Start + CountDownTimer
counter = Format(CountDownTimer - (Timer - Start), "#")
DoEvents
With .lblSecondsCounter
If .Caption <> counter Then
If .Caption = "10" Then
.ForeColor = 255
Me.btnCancelAutorun.ForeColor = 255
Me.lblSeconds.ForeColor = 255
End If
pctcompleted = (Timer - Start) / CountDownTimer
UpdateProgress (pctcompleted)
.Caption = counter
End If
End With
If CancelAutoRun = True Then
RunAutomaticScript = False
.btnGenerateTable.Visible = True
.btnUpdateProdDB.Visible = True
GoTo EndGame
End If
Loop
End With
RunAutomaticScript = True
Notes:
CancelAutoRun is set to true by a button click.
UpdateProgress works with a progress bar. Disabling it does not effect CPU usage.
Endgame just does some simple exit procedure-type stuff.
Any advice would be appreciated... I'm just scratching my head here.
David