Login form when computer idle

M

Michael Nemtsev

Hello Dave,

And what's wrong with timer?
use Application.Idle +=new System.EventHandler(Application_Idle) where in
the Application_Idle handler set the timer on x secs


D> would like to know how I go about showing a login form whenever the
D> compuer is idle for 'x' minutes. I only know that it is going to use
D> timers.
D>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
G

Guest

I would like to know how I go about showing a login form whenever the compuer
is idle for 'x' minutes. I only know that it is going to use timers.
 
G

Guest

Does this event have to be attached to every form in my program? If not where
would I place this 'idle' code?

I was in no way hinting that something is wrong in user timers. I said I
knew timers might be used in the solution. --
L. A. Jones
 
W

Willy Denoyette [MVP]

Application.Idle is triggered when the 'application' message queue is idle,
that is, when there are no more windows messages to be processed, you don't
want to display a dialog each time this happens do you?


Willy.



| Hello Dave,
|
| And what's wrong with timer?
| use Application.Idle +=new System.EventHandler(Application_Idle) where in
| the Application_Idle handler set the timer on x secs
|
|
| D> would like to know how I go about showing a login form whenever the
| D> compuer is idle for 'x' minutes. I only know that it is going to use
| D> timers.
| D>
| ---
| WBR,
| Michael Nemtsev :: blog: http://spaces.live.com/laflour
|
| "At times one remains faithful to a cause only because its opponents do
not
| cease to be insipid." (c) Friedrich Nietzsche
|
|
 
W

Willy Denoyette [MVP]

|I would like to know how I go about showing a login form whenever the
compuer
| is idle for 'x' minutes. I only know that it is going to use timers.
| --
| L. A. Jones

What about to turn-on a password protected screen saver?

Willy.
 
P

PS

Dave said:
Does this event have to be attached to every form in my program? If not
where
would I place this 'idle' code?

Do you have one "main" form that opens after the user logs in and remains
open? If you do then that is where you place the code.

Here is some sample code.

private Timer timer;
private void setupTimer()
{
this.timer = new Timer();
this.timer.Interval = 20000;
this.timer.Tick += new EventHandler(this.timer_Tick);
Application.Idle += new EventHandler(this.Application_Idle);
}

void Application_Idle(object sender, EventArgs e)
{
this.timer.Stop();
this.timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
// log user off
}

PS
 
P

PS

Willy Denoyette said:
Application.Idle is triggered when the 'application' message queue is
idle,
that is, when there are no more windows messages to be processed, you
don't
want to display a dialog each time this happens do you?

Michael was suggesting that the timer be started in this event. I have
implemented the same concept without problems.

Regards,

PS
 
W

Willy Denoyette [MVP]

|
| | > Application.Idle is triggered when the 'application' message queue is
| > idle,
| > that is, when there are no more windows messages to be processed, you
| > don't
| > want to display a dialog each time this happens do you?
|
| Michael was suggesting that the timer be started in this event. I have
| implemented the same concept without problems.
|

The OP was asking about the SYSTEM being idle not an APPLICATION being idle.
Now, what happens if the user switches to another application, are you going
to display a login dialog after the other application has been 'idling' for
a while, even if the user did not leave it's workplace? Quite annoying for
the user isn't it?

Willy.
 

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