Detect Application

  • Thread starter Thread starter Law
  • Start date Start date
L

Law

To all the VB master,

i'm new baby in VB. I would like to get ur's advice on how
to stop the application when user is not in use within 5
or 10mins?

Hope to hear VB master soon.

Tks,
Law
 
Law said:
i'm new baby in VB. I would like to get ur's advice on how
to stop the application when user is not in use within 5
or 10mins?

Hope to hear VB master soon.

I'm not a VB Master but heck :-) Two questions come to mind, the first is
what is your definition of the term not in use? Do you mean they didn't key
anything in? Would it count as being used if they dragged the window,
clicked on help or made a menu choice? The second is... why are you
concerned?

To answer your question I suspect it would be done through a timer that
measures idle time. You can decide which activities count as "use" having
keypresses or mousemoves (or whatever) restart the idle timer. When the
timer reaches (5 or 10 minutes) it would raise an event and off it goes.
..
Tom
 
-----Original Message-----


I'm not a VB Master but heck :-) Two questions come to mind, the first is
what is your definition of the term not in use? Do you mean they didn't key
anything in? Would it count as being used if they dragged the window,
clicked on help or made a menu choice? The second is... why are you
concerned?

To answer your question I suspect it would be done through a timer that
measures idle time. You can decide which activities count as "use" having
keypresses or mousemoves (or whatever) restart the idle timer. When the
timer reaches (5 or 10 minutes) it would raise an event and off it goes.
..
Tom


.

Dear Tom,

Tks for your advice. The defination for the term of not in
use which is means that the end user doesn't key-in
anythings or the application idle for long time..
could you provide me with an example on how to count
as "use" in "keypressed" or "mouseover"? or do you know
there can i get an example from internet?

Thanks for your reply.
Law
 
Law said:
Tks for your advice. The defination for the term of not in
use which is means that the end user doesn't key-in
anythings or the application idle for long time..
could you provide me with an example on how to count
as "use" in "keypressed" or "mouseover"? or do you know
there can i get an example from internet?

I'm sure you can find an example of implementing a timer, there are short
tutorials all over. You probably want to make it public so every part of
your application can reference it.

There is (depending upon the type of timer you use) a property like
..Interval in System.Timers.Timer that can be set. 1000 is one second, 60000
would be one minute, etc. and it fires an Elapsed event every time the
counter gets to zero. If you set it for 10 minutes and then reset it every
time some activity takes place it wouldn't get down to zero and the event
wouldn't fire. That event would shut down the app.

You would have to add code to keyboard and mouse events to reset the
..Interval value.

Tom
 
Back
Top