473,567 Members | 2,902 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 9387
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
1436
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
8115
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
7651
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
7960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6272
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
5216
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3630
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
930
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.