|
tech
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Auto LogoffUsing .NET 2.0...
How can I cause Windows Forms application to shut itself down after a period (say 15 minutes) of [no user activity]? Specifically, I'm wanting some options for detecting that the user is somehow using the application (either detect mouse clicks or keyboard input). The idea is that if the user walks away from their computer and is gone for an extended period, then the app will close itself down to help curb malicious use. This is a Windows Forms MDI app. Thanks. "Smithers" <A@B.com> schrieb: Check out this code for inspiration:> How can I cause Windows Forms application to shut itself down after a > period (say 15 minutes) of [no user activity]? Specifically, I'm wanting > some options for detecting that the user is somehow using the application > (either detect mouse clicks or keyboard input). <URL:http://dotnet.mvps.org/dotnet/code/misc/#UserIdle> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Just wondering if this can be done with 1.1 as well?
-- Show quoteHide quotePaul G Software engineer. "Herfried K. Wagner [MVP]" wrote: > "Smithers" <A@B.com> schrieb: > > How can I cause Windows Forms application to shut itself down after a > > period (say 15 minutes) of [no user activity]? Specifically, I'm wanting > > some options for detecting that the user is somehow using the application > > (either detect mouse clicks or keyboard input). > > Check out this code for inspiration: > > <URL:http://dotnet.mvps.org/dotnet/code/misc/#UserIdle> > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> > > "Paul" <P***@discussions.microsoft.com> schrieb: Yes, for sure.> Just wondering if this can be done with 1.1 as well? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> It is easy to implement it in client side using script.
It works like this: (1) When the page OnLoad in client side, set a timeout to process it. (2) capture mouse activity in this page and reset the timeout Following is the javascript: var tID = 0; var IntTime; function OnActive(page) { clearTimeout(tID); tID = setTimeout("WindowIdle()", IntTime); } function OnPageLoad(page, timeout) { var body = page.document.body; if (timeout > 0) { IntTime = timeout; } // reset the timeout when the page is active body.onclick=OnActive; body.onmousemove=OnActive; tID = setTimeout("WindowIdle()", IntTime); } function WindowIdle() { // do whatever you want, usually redirect to another page } Hope it is useful. WYW Show quoteHide quote "Smithers" <A@B.com> wrote in message news:ODs%2308bIHHA.1248@TK2MSFTNGP02.phx.gbl... > Using .NET 2.0... > How can I cause Windows Forms application to shut itself down after a > period (say 15 minutes) of [no user activity]? Specifically, I'm wanting > some options for detecting that the user is somehow using the application > (either detect mouse clicks or keyboard input). > > The idea is that if the user walks away from their computer and is gone > for an extended period, then the app will close itself down to help curb > malicious use. > > This is a Windows Forms MDI app. > > Thanks. > "wyw" <yw***@globecommsystems.com> schrieb: Hm... The OP posted the question to the Windows Forms group ;-).> It is easy to implement it in client side using script. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Other interesting topics
Bugs, bugs ...
Handling of different return code correspondingly in a stored procedure DrawString on to an image (text on an image) How to send Lotus Notes Email Via C# Simple GUI questions Server Side PDF Tool HELP!!! What triggered this event? PDF with .NET HELP!!! How can we extract assemblies from GAC? SELF SERVICE PASSWORD RESET |
|||||||||||||||||||||||