473,802 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Monitoring keyboard activity

I have a Windows form application running that contains a button and textbox.
An easy thing to do is to monitor the last time a keystroke was executed in
the textbox. I can then click the button and it will say: "The last
keystroke in the textbox was 10 minutes ago."

This is not what I want to do. What I would like to see is a message that
says: "The last keystroke in any running application on this computer was 23
minutes ago."

My guess is that this is easy to do for the C# and C++ world. Unfortunately
my programming skills involve databases, user interfaces and VB. Can someone
point me in the necessary direction for capturing this information from the
OS? I assume this is something that can be done.

Nov 21 '05 #1
2 3534
Hi,

If you are looking to recieve all keys pressed (not just in your
application) you need to use a keyboard hook.
http://www.developer.com/net/net/art...1087_2193301_3

Ken
----------------

"genojoe" <ge*****@discus sions.microsoft .com> wrote in message
news:94******** *************** ***********@mic rosoft.com...
I have a Windows form application running that contains a button and
textbox.
An easy thing to do is to monitor the last time a keystroke was executed in
the textbox. I can then click the button and it will say: "The last
keystroke in the textbox was 10 minutes ago."

This is not what I want to do. What I would like to see is a message that
says: "The last keystroke in any running application on this computer was 23
minutes ago."

My guess is that this is easy to do for the C# and C++ world. Unfortunately
my programming skills involve databases, user interfaces and VB. Can
someone
point me in the necessary direction for capturing this information from the
OS? I assume this is something that can be done.
Nov 21 '05 #2
"genojoe" <ge*****@discus sions.microsoft .com> schrieb:
This is not what I want to do. What I would like to see is a message that
says: "The last keystroke in any running application on this computer was
23
minutes ago."


You'll need a keyboard hook to capture these keystrokes system-wide:

Article on keyboard hooks:

<URL:http://www.developer.c om/net/net/article.php/11087_2193301_1/>

Documentation on hooks:

<URL:http://msdn.microsoft. com/library/en-us/dnwui/html/msdn_hooks32.as p>
<URL:http://msdn.microsoft. com/library/en-us/winui/winui/windowsuserinte rface/windowing/hooks.asp>

HOWTO track a user's idle time
<URL:http://www.codeproject .com/dll/trackuseridle.a sp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

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

Similar topics

0
391
by: Paul Steele | last post by:
I am working in a C# program what monitors the activity on a computer. I have been able to accomplish quite a bit so far, but one item I have not been able to figure out is if there is a way to monitor when a file is opened. The FileSystemWatcher class is useful for monitoring file/directory changes, but all I want is to monitor when a file is opened. Is there any way to do that in .NET? I am also monitoring processes in use on the...
7
10697
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it were a keyboard. I need to be able to identify input from the scanner and keyboard independently. I've looked at DirectX.DirectInput, and using user32.dll to hook into the keyboard messages, but neither method seems to allow for identification of...
3
2326
by: JSheble | last post by:
I have a windows service that in the OnStart it creates a thread and runs a loop forever and ever, assuming the service is running. The loop stops during the OnStop event, and everything works exactly as expected. I also have an application that monitors that service using the ServiceController component, and allows me to start & stop the service as needed, as well as poll for it's current status. Still everything thus far works and...
0
1074
by: Scott Daniel | last post by:
Is is possible to do the above? I know there is a mechanism to monitor 'folder' activity and I have used it. But I'm wondering if there is a way of monitoring for CRM or database activity in a similar fashion to how the monitor "folder" function works? Any help is greatly appreciated. Thanks, Scott
16
10945
by: dfaber | last post by:
Hi all, I have been searching for a keyboard and mouse tracker on linux. I've read solutions (watch at sourceforge) which look at /proc/interrupts to check keyboard or mouse activity. I also read one post where "watch" seems to have difficulty tracking usb keyboards and mice. So, I'm out of ideas here. My goal are: 1. Check keyboard activity. I'm not interested in logging which keys are pressed or record them.
4
1539
by: natG | last post by:
Well folks, I didn't heed the warnings (that excessive monitoring, statistics, etc. can cause a performance hit) and I have been playing around with all kinds of monitors, snapshots, especially with the gui. BUT! Performance has dropped 70%! The monitors show that the the most system overhead is caused by these selects themselves. Question 1: Is there a big red switch that turns OFF *all* of this type of activity! Question 2: If so, can I...
2
2442
by: bic1ster | last post by:
I go in through the Control Center Activity Control Center and eventually select view locks, I get a popup window "The Activity Monitor is unable to collect the required snapshot data because the monitor switch "LOCK" is not turned on at the database manager level." I had run db2 update monitor switches using BUFFERPOOL on LOCK on SORT on STATEMENT on TIMESTAMP on TABLE on UOW on Does DB2 need to be restarted? Does das need a restart?
2
5975
by: Justin | last post by:
So I have a keyboard hook that I have implemeted into my c# app. I need to not allow any hotkey actions to be performed when my app is opened. I can capture the key events and handle them if I want to. The only problem is that I have fields that require input. Do I have to programmatically add the characters to the input fields when I am handling the event. I don't want these keys sent to the system. But only to my program. Or does...
0
1226
by: origami.takarana | last post by:
Dear Reader, Designing for Detection ---------------------------- - Get the right equipment from the start. Make sure all of the features you need, or will need, are available from the start. - Know your environment. Identify potential physical barriers and
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6838
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.