472,341 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 9300
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 AddMessageFilter 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.com

"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 AddMessageFilter 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.com

"Girish Bharadwaj" <girishb@nowhere> wrote in message
news:eY**************@TK2MSFTNGP10.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 AddMessageFilter 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 SetWindowsHookEx
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.com

"Girish Bharadwaj" <girishb@nowhere> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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
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...
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...
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...
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...
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...
1
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...
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...
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...
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 ...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.