Tracking mouse activity in C#

Hi,

I am making a windows form application in C#.
I want to be able to catch ALL the activitites/events that the mouse goes through i.e. move, left click in, left click out (=aka drag), right click in, right click out, mouse scroll etc.

Its very simple setting up event handlers in the app as:
// ---------- start of snippet --------------
this.MouseDown += new MouseEventHandler(Form1_MouseDown);
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
    //blah blah
}
// ---------- end of snippet --------------

BUT, the catch is that I dont only want to capture the mouse activities on my form, BUT INSTEAD I want it to monitor the mouse activities even if my form is not in focus, and even when the mouse is not over the form area.

Picture this application as something which is monitoring every signal recieved from the mouse.
Any help will be appreciated.

This is related to my question, but cant figure out much from it:
http://experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21215146.html

Thanks
dosdemonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dosdemonAuthor Commented:
Sorry I checked back late.

Let me go through these, will let you know about the result.
Thanks.
0
dosdemonAuthor Commented:
AlexGM:
Thanks for the code, it worked well and the way I want it EXCEPT that it does not currently tracks mouse clicks and scrolls etc, I guess I will have to go thru the DLLs doc and structures to know how to capture that too.

Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.