473,325 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Auto Logoff

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.
Dec 17 '06 #1
4 1458
"Smithers" <A@B.comschrieb:
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/>

Dec 17 '06 #2
wyw
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

"Smithers" <A@B.comwrote in message
news:OD****************@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.

Dec 18 '06 #3
"Paul" <Pa**@discussions.microsoft.comschrieb:
Just wondering if this can be done with 1.1 as well?
Yes, for sure.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 18 '06 #4
"wyw" <yw***@globecommsystems.comschrieb:
It is easy to implement it in client side using script.
Hm... The OP posted the question to the Windows Forms group ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Arun Goel | last post by:
Hi all, I have set up rmiregistry.exe to run as service on Windows 2000 Server .. I set it up using "srvany.exe". It is running fine, but when I logoff, it stops.I did a lot of research but I...
8
by: Jonathan Heath | last post by:
Hi all, I have created an ASP script that enters data into an Access Database. My problem is that I'd like this script to run when the computer is shutdown or the user logs off. I think...
4
by: John Ortt | last post by:
Hi Everyone, hope you can help. Our company has recently migrated from NT and Access 97 to XP and Access 2003 and in the process a number of problems have surfaced. The team I work in are...
5
by: PawelR | last post by:
Hello Group, To my apps user must logon. How make auto logoff after any time when user is not active? Please send me samples or link to samples. Thx. Pawel
8
by: Jm | last post by:
Hi All I have an app that when running if a user selects logoff or shutdown from the start menu, it will close itself but not logoff windows or shutdown. From what i have found so far its most...
4
by: Smithers | last post by:
Using .NET 2.0... How can I cause Windows Forms application to shut itself down after a period (say 15 minutes) of ? Specifically, I'm wanting some options for detecting that the user is somehow...
6
by: =?Utf-8?B?Zmh1bnRlcg==?= | last post by:
Hi I have a small .net Windows app that I need to run before the user logs off the machine. This is a Windows App where a dialog is displayed to the user and he/she needs to answer before the...
3
by: =?Utf-8?B?Zmh1bnRlcg==?= | last post by:
I have a Windows Service that should pop a windows form right before logoff, for the user to enter some information. I got things working fairly well except that the user does not get to see the...
0
by: remya1000 | last post by:
i'm using VB.NET. i wrote a Auto Reboot program. and here is the codes i tried... Code: Private Enum ShutDown1 LogOff = 0 Shutdown = 1 Reboot = 2 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.