473,395 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Auto Time Out

Hi all.

I have a requirement to Auto Time Out an application after a certain amount
on inactive time. If the user hasn't typed anything into the application,
and hasn't clicked any control the app will close all open forms, apart from
the main form and display the login.

I'm OK with most of this, but what is the best way to ensure each click or
key press is recorded? I don't want to put lines of code behind everything
for obvious reasons!

Cheers,
Tull.
Mar 16 '07 #1
3 1339
Hey, Funny to see this posting because I was just about to ask a question
about auto time out. I would like to do the same thing in my application and
really have no idea how to do this, is there a good site i can refer to?

"tclancey" wrote:
Hi all.

I have a requirement to Auto Time Out an application after a certain amount
on inactive time. If the user hasn't typed anything into the application,
and hasn't clicked any control the app will close all open forms, apart from
the main form and display the login.

I'm OK with most of this, but what is the best way to ensure each click or
key press is recorded? I don't want to put lines of code behind everything
for obvious reasons!

Cheers,
Tull.
Mar 16 '07 #2
Funny, I just ran across something this morning that might be useful.

application.AddMessageFilter: Use a message filter to prevent specific
events from being raised or to perform special operations for an event
before it is passed to an event handler. Message filters are unique to
a specific thread.

Google turns up some examples, including one from the MSDN which
filters out all left-clicks.

You could monitor mouse and keyboard events for the entire app with
this. A couple of tips:

1) Make sure your filter is fast and lean. It will be handling *lots*
of events, and you don't want to slow down your app.
2) Don't consider the mouse to have moved unless it moves more than
some threshold, like 8 pixels. Many mice tend to jitter a pixel or
two. They can also jitter *subpixel* amounts - which generates
extraneous MouseMove events that report the mouse hasn't moved (since
it can only report whole pixels).

For an easier alternative, you could use a timer that fires every
100ms or so, and checks the mouse position and keyboard state. This
could miss key presses if they occur between timer intervals. But
normally, you can't use an app for more than a few seconds without
moving the mouse anyway.

Mar 16 '07 #3
Many thanks for this info, looks exactly what I'm looking for.
Cheers,
Tull.

<te******@hotmail.comwrote in message
news:11**********************@p15g2000hsd.googlegr oups.com...
Funny, I just ran across something this morning that might be useful.

application.AddMessageFilter: Use a message filter to prevent specific
events from being raised or to perform special operations for an event
before it is passed to an event handler. Message filters are unique to
a specific thread.

Google turns up some examples, including one from the MSDN which
filters out all left-clicks.

You could monitor mouse and keyboard events for the entire app with
this. A couple of tips:

1) Make sure your filter is fast and lean. It will be handling *lots*
of events, and you don't want to slow down your app.
2) Don't consider the mouse to have moved unless it moves more than
some threshold, like 8 pixels. Many mice tend to jitter a pixel or
two. They can also jitter *subpixel* amounts - which generates
extraneous MouseMove events that report the mouse hasn't moved (since
it can only report whole pixels).

For an easier alternative, you could use a timer that fires every
100ms or so, and checks the mouse position and keyboard state. This
could miss key presses if they occur between timer intervals. But
normally, you can't use an app for more than a few seconds without
moving the mouse anyway.

Mar 17 '07 #4

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

Similar topics

5
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge...
8
by: Seth | last post by:
How can I completely turn off the auto formatting of Html in Visual Studio 7? I have tried all possible combinations (at least I think I have) of the Tools / Options / Text Editor / HTML XML /...
8
by: Prometheus Research | last post by:
http://newyork.craigslist.org/eng/34043771.html We need a JavaScript component which will auto-submit a form after a set period has elapsed. The component must display a counter that dynamically...
6
by: Corepaul | last post by:
I am new to Access 2000. My operating system is Windows 2000. In the early stage of development I noticed something weird. On my form, I have a Command Button named "btnAlbumUp". The first time...
20
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
2
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Following the samples online, we implemented a windows service in .Net. Like most services, there's a worker thread actually doing stuff in the background. The problem we've run into is...
21
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
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...
0
marktang
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,...
0
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...
0
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,...
0
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...

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.