Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Detect idle computer

Posted on 2006-05-15
2
Medium Priority
?
1,069 Views
Last Modified: 2008-01-09
How would I go about detecting if the computer has gone idle? maybe screen saver or monitor power saver ?
0
Comment
Question by:addicktz
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
topdog770 earned 2000 total points
ID: 16686272
Use the OnIdle ( ok.. C# Application.Idle  ) event

=================================================
from < http://www.personalmicrocosms.com/Pages/dotnettips.aspx#onidle >
=================================================
The best way to enable and disable buttons, menu items and toolbar buttons
Write an OnIdle method and put your GUI enable/disable code there. The OnIdle method is called every time your application's message queue becomes empty.

Hook in the OnIdle method in a Form's constructor by instantiating an EventHandler and adding that hander to the Appliction object's Idle property. Update the form's GUI in the OnIdle method. Finally, be sure to remove the EventHandler from the Application object's Idle property when the Form is about to close.

...
private EventHandler idleEventHandler;
...

public SettingsForm(InitialTabPage initialTabPage)
{
      InitializeComponent();

...

      idleEventHandler = new System.EventHandler(OnIdle);
      Application.Idle += idleEventHandler;
}

...

private void OnIdle(object sender, EventArgs e)
{
      // Update form's UI when program is idle.

      deleteButton.Enabled = assemblyListBox.SelectedIndex != -1;
}

private void SettingsForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
...

      Application.Idle -= idleEventHandler;
}
0
 
LVL 12

Assisted Solution

by:topdog770
topdog770 earned 2000 total points
ID: 16686284
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question