Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create an utility which counts the number of keys pressed in an our even if the application has not got the focus the application should run in the background i wish to develop it in c#
how can i achieve this
Posted
Comments
Sandeep Mewara 3-May-11 2:46am    
You wish but did you try anything?
CodeHawkz 3-May-11 3:37am    
Look for something called "global keyboard and mouse hooks". These are a set of API which allows you to trigger events when the user moves the mouse or uses the keyboard. There are plenty of articles written about it in CodeProject itself.

Hope this helps :)

1 solution

Keyboard hooking is the answer you're looking for.
You'll have to interact with a Windows DLL for that, but there are plenty of good articles on it on codeproject.
Try this Global Mouse and Keyboard Library[^].
I believe it contains all you need.
 
Share this answer
 
v2
Comments
Kim Togo 3-May-11 6:54am    
My 5. Good link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900