473,569 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto logoff

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
Nov 15 '05 #1
5 9388
Pawel,

Figuring out inactivity in an application is difficult, at best. What
you will want to do is probably hook into the applications main message loop
(by implementing the IMessageFilter interface and registering it on the
Application through the static AddMessageFilte r method). In there, you
would look for any mouse movement messages, and any keystroke messages. You
would also have a timer which would be reset every time one of these
messages came in. If the timer ever fires (the timer would br set to fire
after your timeout period, for example, set the timer to fire every three
minutes if you want your application to quit after three minutes of
inactivity), then you know the app was inactive, and you can log out.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"PawelR" <pa************ @poczta.onet.pl > wrote in message
news:MP******** *************** *@news.tpi.pl.. .
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

Nov 15 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Pawel,

Figuring out inactivity in an application is difficult, at best. What
you will want to do is probably hook into the applications main message loop
(by implementing the IMessageFilter interface and registering it on the
Application through the static AddMessageFilte r method). In there, you
would look for any mouse movement messages, and any keystroke messages. You
would also have a timer which would be reset every time one of these
messages came in. If the timer ever fires (the timer would br set to fire
after your timeout period, for example, set the timer to fire every three
minutes if you want your application to quit after three minutes of
inactivity), then you know the app was inactive, and you can log out.

Hope this helps.

Or,..
You can write a screen saver.. Let windows take care of activating you
and when it does.. log off the user..
:)
--
Girish Bharadwaj

Nov 15 '05 #3
Girish,

That's a great hack! I mean, it is hackish, but its actually a great
mechanism. Here are the problems with that though:

- There is only one screen saver on the system, so you will eliminate
another one (which might be needed or desired)
- Is there a way from within the screen saver to indicate that it should
stop, or can you just exit the program?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Girish Bharadwaj" <girishb@nowher e> wrote in message
news:eY******** ******@TK2MSFTN GP10.phx.gbl...
Nicholas Paldino [.NET/C# MVP] wrote:
Pawel,

Figuring out inactivity in an application is difficult, at best. What you will want to do is probably hook into the applications main message loop (by implementing the IMessageFilter interface and registering it on the
Application through the static AddMessageFilte r method). In there, you
would look for any mouse movement messages, and any keystroke messages. You would also have a timer which would be reset every time one of these
messages came in. If the timer ever fires (the timer would br set to fire after your timeout period, for example, set the timer to fire every three minutes if you want your application to quit after three minutes of
inactivity), then you know the app was inactive, and you can log out.

Hope this helps.

Or,..
You can write a screen saver.. Let windows take care of activating you
and when it does.. log off the user..
:)
--
Girish Bharadwaj

Nov 15 '05 #4
Nicholas Paldino [.NET/C# MVP] wrote:
Girish,

That's a great hack! I mean, it is hackish, but its actually a great
mechanism. Here are the problems with that though:

- There is only one screen saver on the system, so you will eliminate
another one (which might be needed or desired)
- Is there a way from within the screen saver to indicate that it should
stop, or can you just exit the program?

Heheh.. I agree. Its a hack. :)
As for the two problems, if you agree that a Screen saver is the way to go..
For one, I would just write the "settings" for that saver to provide a
list of screen savers available and a time out on them as well. Of
course the idea now is that you will have two times one when the logoff
screensaver comes active and the *real* screen saver also becomes
active. And after a certain time out, the real screen saver is killed by
the logoff screen saver and logged off..
You can do that since its similar to one of those marquee screen savers..
or else,
the poster can write his own cool screen saver (a chance to play with
DirectX maybe).. :)

Seriously, I would expect a place where you need a auto logoff mechanism
to be deployed would not be too averse to having a screensaver set to
such a thing .. since this makes most sense in a kiosk kind of env and
there system admin is king.. :)
--
Girish Bharadwaj

Nov 15 '05 #5
Girish,

Even easier. When the screen saver is run, it posts a message of type
WM_SYSCOMMAND, where the wParam parameter is the value SC_SCREENSAVE. This
message can be processed if you set a hook using the SetWindowsHookE x
function which would filter the windows messages.

However, this still limits your timeout to whatever the screen saver is
set to, which is a pain.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Girish Bharadwaj" <girishb@nowher e> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
Nicholas Paldino [.NET/C# MVP] wrote:
Girish,

That's a great hack! I mean, it is hackish, but its actually a great mechanism. Here are the problems with that though:

- There is only one screen saver on the system, so you will eliminate
another one (which might be needed or desired)
- Is there a way from within the screen saver to indicate that it should
stop, or can you just exit the program?

Heheh.. I agree. Its a hack. :)
As for the two problems, if you agree that a Screen saver is the way to

go.. For one, I would just write the "settings" for that saver to provide a
list of screen savers available and a time out on them as well. Of
course the idea now is that you will have two times one when the logoff
screensaver comes active and the *real* screen saver also becomes
active. And after a certain time out, the real screen saver is killed by
the logoff screen saver and logged off..
You can do that since its similar to one of those marquee screen savers..
or else,
the poster can write his own cool screen saver (a chance to play with
DirectX maybe).. :)

Seriously, I would expect a place where you need a auto logoff mechanism
to be deployed would not be too averse to having a screensaver set to
such a thing .. since this makes most sense in a kiosk kind of env and
there system admin is king.. :)
--
Girish Bharadwaj

Nov 15 '05 #6

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

Similar topics

1
5087
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 am not able to find out what is the problem. I have "Interact with active desktop" unchecked. If I login after logoff, then rmiregistry is not...
8
2755
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 this would be simple enough if the ASP didn't have any user input, but it does.
4
1712
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 responsible for managing a number of databases, some of which are updated on a desktop machine and then copied to the networked drives. We overwrite...
8
3447
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 likely something ive declared in my program that is preventing the logoff, i have tried closing and disposing forms and sql connections, is there...
4
1475
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 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...
1
1482
by: =?Utf-8?B?UnVkeQ==?= | last post by:
Hello all! Any idea how I ca set up a Auto logout. If the program is inactive for 3 minutes or wahtwerv. I know I can use a timer. But what declartionon the form would be best used? Or maybe there is a better way? TIA!! Rudy
6
1599
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 computer continues to logoff. I currently have the application running as a logoff script. In other words I use the Group Policy window to add the...
3
2259
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 form before logoff. But I know that it run properly because when I log back in the form is there and works fine. So the form opened and run, but...
0
1437
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 ForcedLogOff = 4
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.