Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program-wide timer reset by key press on any form

Status
Not open for further replies.

MikeKaufman

Programmer
Mar 29, 2002
2
US
I would like (using VB6) some kind of a timer which will detect inaction in the program for 15 minutes. Any click in any control on any form will reset the timer = 0.
 
what type of inaction you will need to set triggers on a gotfocus, or validate in many or even all of the funcitons to catch the activity. Somone else may have a better idea for detecting activity, like mouse move.

But what you could do is add a timer control to your form with the interval of 60,000 (that's 1 minute). Then place this code in your general declarations section
[tt]
Global lgTimer as Long

Private Sub Timer1_Timer()
lgTimer = lgTimer + 1

If lgTimer = 15 '15 being your minute timer

'Do your events here

'Reset your Timer to 0

lgTimer = 0
End if
End Sub
[/tt]
Then add this code into the places in your code that would show activity for the program
[tt]
lgTimer =0
[/tt]
Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top