Hi,
I've a situation where my application has to manage usernames and passwords,
and after a certain amount of idle time, the application will log the
current user out, (assuming they've left without logging out manually) and
prompt for a new log in.
Is there any way to do this, without having to call a reset method on the
timer i've got running in just about every method...
i.e. a global method holds a countdown of idle time, that is reset to my
timeout time everytime the user presses a key, clicks a button, so that when
the idle timer reaches zero, there's been no activity and it logs the user
out.
Is there a cleaner way about this?
Thanks.
Daniel 4 1652
Daniel,
I had to do this in VB6, but you should be able to implement the same
solution in your application. First, what you have to do is place a timer
in your application (your main form would do just fine). The resolution of
the timer is how much of a leeway you are willing to give the user for that
threshold (for example, if your threshold is 30 seconds, but it's ok if the
user takes 35, then set the timer resolution for five seconds).
Additionally, you would have a DateTime variable which is easily
accessible. Initialize this instance to the current time when the
application starts (or is finished initializing, basically, when you enable
the timer).
Then, create a class that implements IMessageFilter and pass an instance
of the implementation to the static AddMessageFilter method on the
Application class. Your implementation is going to look for any events
(mouse or keyboard) which are sent to the application. When you see the
windows message representing the event, set the DateTime variable to the
current time (or tickcount).
Then, in the timer event, you check the TimeSpan between Now (when the
timer fired), and the variable that is stored. If the TimeSpan is more than
your threshold, then you can log the user out.
In VB6, I did this with keyboard and mouse hooks for the current
process, and you can go that route in .NET, but it might be easier to do
with the IMessageFilter interface.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:ei**************@TK2MSFTNGP11.phx.gbl... Hi,
I've a situation where my application has to manage usernames and
passwords, and after a certain amount of idle time, the application will log the current user out, (assuming they've left without logging out manually) and prompt for a new log in.
Is there any way to do this, without having to call a reset method on the timer i've got running in just about every method... i.e. a global method holds a countdown of idle time, that is reset to my timeout time everytime the user presses a key, clicks a button, so that
when the idle timer reaches zero, there's been no activity and it logs the user out.
Is there a cleaner way about this?
Thanks. Daniel
Thanks, that sounds the sort of things I'm looking for...
one bit of information I left out is this is for a c# app, but it's for a
Windows Mobile 2003 platform... will that make a difference?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uC**************@TK2MSFTNGP11.phx.gbl... Daniel,
I had to do this in VB6, but you should be able to implement the same solution in your application. First, what you have to do is place a timer in your application (your main form would do just fine). The resolution
of the timer is how much of a leeway you are willing to give the user for
that threshold (for example, if your threshold is 30 seconds, but it's ok if
the user takes 35, then set the timer resolution for five seconds).
Additionally, you would have a DateTime variable which is easily accessible. Initialize this instance to the current time when the application starts (or is finished initializing, basically, when you
enable the timer).
Then, create a class that implements IMessageFilter and pass an
instance of the implementation to the static AddMessageFilter method on the Application class. Your implementation is going to look for any events (mouse or keyboard) which are sent to the application. When you see the windows message representing the event, set the DateTime variable to the current time (or tickcount).
Then, in the timer event, you check the TimeSpan between Now (when the timer fired), and the variable that is stored. If the TimeSpan is more
than your threshold, then you can log the user out.
In VB6, I did this with keyboard and mouse hooks for the current process, and you can go that route in .NET, but it might be easier to do with the IMessageFilter interface.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote
in message news:ei**************@TK2MSFTNGP11.phx.gbl... Hi,
I've a situation where my application has to manage usernames and passwords, and after a certain amount of idle time, the application will log the current user out, (assuming they've left without logging out manually)
and prompt for a new log in.
Is there any way to do this, without having to call a reset method on
the timer i've got running in just about every method... i.e. a global method holds a countdown of idle time, that is reset to my timeout time everytime the user presses a key, clicks a button, so that when the idle timer reaches zero, there's been no activity and it logs the
user out.
Is there a cleaner way about this?
Thanks. Daniel
Nicholas,
I've looked into this, but don't understand how i can create a class that
implements an unmanaged interface.
Dan.
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:eI**************@TK2MSFTNGP09.phx.gbl... Thanks, that sounds the sort of things I'm looking for...
one bit of information I left out is this is for a c# app, but it's for a Windows Mobile 2003 platform... will that make a difference?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:uC**************@TK2MSFTNGP11.phx.gbl... Daniel,
I had to do this in VB6, but you should be able to implement the
same solution in your application. First, what you have to do is place a
timer in your application (your main form would do just fine). The resolution of the timer is how much of a leeway you are willing to give the user for that threshold (for example, if your threshold is 30 seconds, but it's ok if the user takes 35, then set the timer resolution for five seconds).
Additionally, you would have a DateTime variable which is easily accessible. Initialize this instance to the current time when the application starts (or is finished initializing, basically, when you enable the timer).
Then, create a class that implements IMessageFilter and pass an instance of the implementation to the static AddMessageFilter method on the Application class. Your implementation is going to look for any events (mouse or keyboard) which are sent to the application. When you see the windows message representing the event, set the DateTime variable to the current time (or tickcount).
Then, in the timer event, you check the TimeSpan between Now (when
the timer fired), and the variable that is stored. If the TimeSpan is more than your threshold, then you can log the user out.
In VB6, I did this with keyboard and mouse hooks for the current process, and you can go that route in .NET, but it might be easier to do with the IMessageFilter interface.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in message news:ei**************@TK2MSFTNGP11.phx.gbl... Hi,
I've a situation where my application has to manage usernames and passwords, and after a certain amount of idle time, the application will log the current user out, (assuming they've left without logging out manually) and prompt for a new log in.
Is there any way to do this, without having to call a reset method on the timer i've got running in just about every method... i.e. a global method holds a countdown of idle time, that is reset to
my timeout time everytime the user presses a key, clicks a button, so
that when the idle timer reaches zero, there's been no activity and it logs the user out.
Is there a cleaner way about this?
Thanks. Daniel
never mind, it's part of System.Windows.Forms!
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl... Nicholas,
I've looked into this, but don't understand how i can create a class that implements an unmanaged interface.
Dan.
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote
in message news:eI**************@TK2MSFTNGP09.phx.gbl... Thanks, that sounds the sort of things I'm looking for...
one bit of information I left out is this is for a c# app, but it's for
a Windows Mobile 2003 platform... will that make a difference?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uC**************@TK2MSFTNGP11.phx.gbl... Daniel,
I had to do this in VB6, but you should be able to implement the same solution in your application. First, what you have to do is place a timer in your application (your main form would do just fine). The
resolution of the timer is how much of a leeway you are willing to give the user for that threshold (for example, if your threshold is 30 seconds, but it's ok
if the user takes 35, then set the timer resolution for five seconds).
Additionally, you would have a DateTime variable which is easily accessible. Initialize this instance to the current time when the application starts (or is finished initializing, basically, when you enable the timer).
Then, create a class that implements IMessageFilter and pass an instance of the implementation to the static AddMessageFilter method on the Application class. Your implementation is going to look for any
events (mouse or keyboard) which are sent to the application. When you see
the windows message representing the event, set the DateTime variable to
the current time (or tickcount).
Then, in the timer event, you check the TimeSpan between Now (when
the timer fired), and the variable that is stored. If the TimeSpan is
more than your threshold, then you can log the user out.
In VB6, I did this with keyboard and mouse hooks for the current process, and you can go that route in .NET, but it might be easier to
do with the IMessageFilter interface.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk>
wrote in message news:ei**************@TK2MSFTNGP11.phx.gbl... > Hi, > > I've a situation where my application has to manage usernames and passwords, > and after a certain amount of idle time, the application will log
the > current user out, (assuming they've left without logging out
manually) and > prompt for a new log in. > > Is there any way to do this, without having to call a reset method
on the > timer i've got running in just about every method... > i.e. a global method holds a countdown of idle time, that is reset
to my > timeout time everytime the user presses a key, clicks a button, so that when > the idle timer reaches zero, there's been no activity and it logs
the user > out. > > Is there a cleaner way about this? > > Thanks. > Daniel > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jjesso |
last post by:
I am trying to add a new logging level.
logging.config.fileConfig("bengineLog.cfg")
logging.CLIENT = logging.INFO + 1
logging.addLevelName( logging.CLIENT, 'CLIENT' )
logging.root.setLevel( )...
|
by: Karuppasamy |
last post by:
H
I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net
I installed everything as per the Instructions given in the 'Development Using the Logging Block'
...
|
by: pmatos |
last post by:
Hi all,
I am trying to create a simple but efficient C++ logging class. I know
there are lots of them out there but I want something simple and
efficient. The number one requirement is the...
|
by: Rotem |
last post by:
Hi,
while working on something in my current project I have made several
improvements to the logging package in Python, two of them are worth
mentioning:
1. addition of a logging record field...
|
by: Burkhard Schultheis |
last post by:
As I wrote last week, we have a problem with a DB2 V8 on Linux. Here is
what is in db2diag.log during online backup:
Starting a full database backup.
2004-04-01-02.33.54.760164 ...
|
by: robert |
last post by:
As more and more python packages are starting to use the bloomy
(Java-ish) 'logging' module in a mood of responsibility and as I am not
overly happy with the current "thickener" style of usage, I...
|
by: rajesh.hanchate |
last post by:
Please help me in resolving this issue.
I am using EnterpriseLibrary 2.0 Exception and logging block for
logging exceptions to event log. It works fine for sometime. After some
time it stops...
|
by: Chris Shenton |
last post by:
I am setting up handlers to log DEBUG and above to a rotating file and
ERROR and above to console. But if any of my code calls a logger
(e.g., logging.error("foo")) before I setup my handlers, the...
|
by: Lowell Alleman |
last post by:
Here is the situation: I wrote my own log handler class (derived from
logging.Handler) and I want to be able to use it from a logging config
file, that is, a config file loaded with the...
|
by: samwyse |
last post by:
In the Python 2.5 Library Reference, section 14.5.3 (Logging to
multiple destinations), an example is given of logging to both a file
and the console. This is done by using logging.basicConfig()...
|
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
|
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: 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: 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...
|
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: 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...
|
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,...
| |