Click here to Skip to main content
15,908,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
i want to close my application when it is in idle using timer control, and i want to read mouse cursor for that when no activities in mouse pointer my application should close in 60 second. please help me.
Posted

Hi,

you could use this article that describes checking for user inactivity:
How to check for user inactivity with and without platform invokes in C#[^]
If there was no activity for your given time, you could simply close your app.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Mar-11 12:54pm    
Good enough, a 5, but also see my Answer.
--SA
Espen Harlinn 24-Mar-11 3:46am    
Nice link, my 5
Hey!

I found this article[^] right here at the code project that should be able to help you. Hope you'll work it out, let us know!

Good luck,

Eduard
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Mar-11 12:33pm    
The hook is useful when you solve this problem, my 5. My idea is different, "don't do it". Please see my Answer, and especially the reference. At that time people offered different implementations and I put forward the idea to create a contest ""Most Elegant and Comprehensive Solution of a Completely Useless Task".

I actually started. Please see my Question (at the moment, my only Question, see from my profile...) What do you think?

--SA
That all was discussed before, see: Close windows application automatically[^]

Than again: don't do it! See the discussion, it is useful and include the solutions you need. But… don't do it.

—SA
 
Share this answer
 
Comments
Espen Harlinn 24-Mar-11 3:47am    
Good advice, my 5
Sergey Alexandrovich Kryukov 24-Mar-11 12:29pm    
Thank you, Espen.
--SA
Why can't you just implement a boolean member that gets reset anytime a user interacts with your application. That way your timer can check if the boolean is false and close the application down. that's the way I would do it. Well, in fact I wouldn't close the application down, just disable the user interface until the user logs in again.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900