5

I wan't to popup a specific form when the user didn't use the program for 2 minutes, let's say.

Means: When the application run, and the user didn't press any key / any button / didn't move the cursor at all for 2 minutes, I want the application to detect it and to show an instance of one of the form's window. I use winform application in c#.

How can I do it? Tal.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
Tal
  • 321
  • 2
  • 6
  • Possible duplicate of http://stackoverflow.com/q/6282298/731323 or http://stackoverflow.com/q/6282298/731323 – DanielB Jun 09 '11 at 07:58

2 Answers2

5

See the Application.Idle event and this related question:

How to detect when the program is idle?

There is also a detailed example here:

http://www.codeproject.com/KB/miscctrl/Application_Idle.aspx

Community
  • 1
  • 1
ColinE
  • 68,894
  • 15
  • 164
  • 232
  • well the examples I saw are much complicated than what I mean, but most of them has no attitude to the timer intervals. Do you have any simple example for me? Do I have to use 2 events: the idle event and the timer event? – Tal Jun 09 '11 at 12:20
  • 1
    Yes .. you have to put some effort into this yourself! Creating a timer and handling events form it will only take 1 minute to code! – ColinE Jun 09 '11 at 12:28
  • Maybe it's because I'm a beginner... It doesn't work. Don't you have any simple example for me? please?? – Tal Jun 09 '11 at 13:38
0

Does your application does itself some work with out users intervention? In such case, you cant get the idle time at all.

May be use timers would be a best option in such cases!!

Zenwalker
  • 1,883
  • 1
  • 14
  • 27