detect idle and screen saver

H

hnq51834

I'm using the code posted in KB 128814 to create a detect idle screen in NT 4, Acc 97. The problem is that the screen saver stops the timer from incrementing and closing the app (i've added a debug.print expiredtime to track it). Does anyone know of a work around? Otherwise, it workds great without the screensaver glitch. Thanks

-ha

Private Sub Form_Timer(
' IDLEMINUTES determines how much idle time to wait for befor
' running the IdleTimeDetected subroutine
Const IDLEMINUTES = 2

Static PrevControlName As Strin
Static PrevFormName As Strin

Dim ActiveFormName As Strin
Dim ActiveControlName As Strin
Dim ExpiredMinute
Dim StTimer As Singl
Dim EndTimer As Singl

StTimer = Time

If strCurrentDB <> "Rpt" The
Call UpdateRp
End I

On Error Resume Nex

' Get the active form and control name

ActiveFormName = Screen.ActiveForm.Nam
If Err The
ActiveFormName = "No Active Form
Err =
End I

ActiveControlName = Screen.ActiveControl.Nam
If Err The
ActiveControlName = "No Active Control
Err =
End I

' Record the current active names and reset ExpiredTime if
' 1. They have not been recorded yet (code is runnin
' for the first time)
' 2. The previous names are different than the current one
' (the user has done something different during the time
' interval)
If (PrevControlName = "") Or (PrevFormName = "")
Or (ActiveFormName <> PrevFormName)
Or (ActiveControlName <> PrevControlName) The
PrevControlName = ActiveControlNam
PrevFormName = ActiveFormNam
ExpiredTime =
Els
' ...otherwise the user was idle during the time interval, s
' increment the total expired time
EndTimer = Time
ExpiredTime = ExpiredTime + Me.TimerInterval + ((EndTimer - StTimer) * 1000

Debug.Print ExpiredTime '****this time stabilizes at random and does not incremen
End I

' Does the total expired time exceed the IDLEMINUTES
ExpiredMinutes = (ExpiredTime / 1000) / 6
If ExpiredMinutes >= IDLEMINUTES The
' ...if so, then reset the expired time to zero..
ExpiredTime =
' ...and call the IdleTimeDetected subroutine
IdleTimeDetected ExpiredMinute
End I
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top