How can I tell if the system is 'idle', or the screen saver is running, or the machine is locked?

K

Kevin Buchan

How can I tell if the system is 'idle', or the screen saver is
running, or the machine is locked?
I am writing an application that could really benefit from knowing
this information. During 'idle' time, I could do some of the slightly
heavier processing; during the 'working' time, I would display the
non-intrusive notifications that I don't want my customer to miss.

I see that I can apparently set the thread priority of my background
process to 'ProcessPriorityClass.Idle' and it should only kick off
when the system is idle, but I'm not certain if this is the 'best'
way... it sounds good, though.

Just some URLs or mention of some API's would be sufficient.

Thanks.


-Kevin Buchan
(e-mail address removed)
 
G

Guest

I would strongly recommend going with setting the priority of the thread. Why try to reinvent the wheel, when Microsoft has already done the dirty work for you?

Eric
 
K

Kevin Buchan

Thanks to you both for such fast responses.


-Kevin Buchan
(e-mail address removed)
 
K

Kevin Buchan

(Followup message)

I cannot read the language that the comments were written in, but the
code is completely clear.

Thank you very much for this sample.


-Kevin Buchan
(e-mail address removed)
 
H

Herfried K. Wagner [MVP]

* Kevin Buchan said:
I cannot read the language that the comments were written in, but the
code is completely clear.

VB.NET is the language everybody here is speaking.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top