[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

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.
0
afos21
Asked:
afos21
  • 2
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now