Monitoring keyboard activity

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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/article.php/11087_2193301_3

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

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.
 
genojoe said:
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.com/net/net/article.php/11087_2193301_1/>

Documentation on hooks:

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top