PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Mark Strickland on May 12, 2008, 11:59:15 PM

Title: Inactivity Timer
Post by: Mark Strickland on May 12, 2008, 11:59:15 PM
I need to create an inactivity timer for a FF project with many forms.

Is there an easy place to detect keyboard activity and mouse movement in a single place that does not have to be in every form?

Thanks.
Title: Re: Inactivity Timer
Post by: paulDiagnos on May 13, 2008, 01:47:24 PM
Unfortunately the only way i know how to do it would be to detect mouse / keyboard messages  for each form.

erm they maybe something in the winapi about system in activity ?

sorry prob not much help./
Title: Re: Inactivity Timer
Post by: TechSupport on May 13, 2008, 03:56:17 PM
I am not at my development computer at the moment so this is off the top of my head - totally untested. Maybe put the code in FF_PumpHook.


Function FF_PUMPHOOK(Msg As tagMsg) As Long

   ' Catch a mousemove or keyboard action.....
   Select Case Msg.message
      Case %WM_MOUSEMOVE, %WM_LBUTTONDOWN, %WM_LBUTTONUP, %WM_KEYUP, %WM_KEYDOWN, %WM_CHAR, etc......
         ' respond to the movement (screensaver?)
   End Select

End Function
Title: Re: Inactivity Timer
Post by: Mark Strickland on May 13, 2008, 05:40:31 PM
Pretty good without a computer --- Right on.  EXACTLY RIGHT ON!   8)

I did not even think about the PumpHook function.

That will do the trick.  I will set a (dreaded GLOBAL  :o ) and on mouse or keyboard input reset it to zero.  A timer will increment it so it can auto exit the program after a few hours after a certain time of the day.  This will "kick out" the "turkeys" that stay in the application, go home, and keep the files from being backed up later.

THANKS!!