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 5 9367
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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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,...
| |