473,385 Members | 1,983 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,385 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 2988
"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...
2
by: Michael | last post by:
Hi, I was creating a trigger to fire when a user ends a session, but I see that you could have it fire on a SCHEMA event : CREATE TRIGGER "SRU"."TEST" BEFORE LOGOFF ON "SRU".SCHEMA or a...
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 ...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.