By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,993 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,993 IT Pros & Developers. It's quick & easy.

Monitoring keyboard activity

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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*****@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.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

P: n/a
"genojoe" <ge*****@discussions.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.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>

--
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 discussion thread is closed

Replies have been disabled for this discussion.