A brief understanding on how capturing windows messages work

My aim is to handle selected windows messages. I've been navigating through Internet and they are all very mixed up. I would be grateful if someone will link me a tutorial or help me understand how the procedure works since i'm completely lost.
afos21Asked:
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.

minnirokCommented:
You want to capture windows messages in your MFC application? You can handle messages to the current window you're conerned with. Look at the documentation for CWnd:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.asp

Most of the OnXXX() member functions are mapped message handlers. For instance:

    CWnd::OnLButtonDown();

will fire when the user left clicks in that window. Are you developing for MFC, or just plain win32? And what messages do you want to handle? If you give this information I can give specific examples for you.

0
DanRollinsCommented:
... Or are you interested in capturing/monitoring window messages in *other applications* (other than the programs you write yourself).  The techniques are very different.
0
afos21Author Commented:
actually, my purpose is to write a mouse recorder application. I wasn't given any restrictions. I'm free to choose any programming language i want. They told me is much easier to do it with java but i choosed c++ because i'm more familiar with
0
DanRollinsCommented:
You need to write what is called a Windows Hook.  In order to record mouse clicks and movement in an external APP, it must be a global hook  and it must reside in a DLL.

Here is a link to some source code that does waht you want
      http://www.codeproject.com/tools/hookmanager.asp

Here is one answer from another question at EE:
      http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20297950.html
And here is an EE search to a bunch of related questions:
     http://search.experts-exchange.com/jsp/search.jsp?query=hook%20wh_mouse%20global%20DLL&topics=80#topSearch

Here is the MSDN topic at Microsoft:
    http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/abouthooks.asp
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
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
System Programming

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.