CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2008
    Posts
    50

    How to record mouse events on other objects?

    Dear all,

    Assume we have 3 buttons from an application: A, B, and C.

    Now I want to record the mouse events on the buttons using another application. For example, if the user clicked button A first, then C, then B, the application should give us a report like the following:

    clicked A
    clicked C
    clicked B

    !!!NOTE: The requirement is that you cannot alter the code of the buttons because it was developed by someone else.

    This problem bothered me a lot and I still cannot find a way to do it.
    Could someone help me?

    Thanks in advance!
    Last edited by kagohaik; April 3rd, 2009 at 02:01 PM.

  2. #2
    Join Date
    Jul 2008
    Posts
    70

    Re: How to record mouse events on other objects?

    Well monitoring events of another application can prove tricky.

    Microsoft Research has a cool utility called detours. That lets you hook into another process. Using this you could do what you want.

    But you should know c++ pretty well if your going to try this, other than that its pretty straight forward.

    Here's the official site. http://research.microsoft.com/sn/detours/

    If you go this route and get stuck just post a reply I'll be glad to try and help.

  3. #3
    Join Date
    Jan 2008
    Posts
    178

    Re: How to record mouse events on other objects?

    Quote Originally Posted by compavalanche
    Microsoft Research has a cool utility called detours.
    Irrelevant.
    Api hooking has nothing to do with message hooking, which is the right method.

  4. #4
    Join Date
    Jul 2008
    Posts
    50

    Re: How to record mouse events on other objects?

    Hi Fred, do you mind to elaborate more on the message hooking?

    Thanks.

  5. #5
    Join Date
    Dec 2007
    Posts
    17

    Re: How to record mouse events on other objects?

    wm_ windows message hooking (mouse, keyboard, journalrecord...)

    via what you describe, doesn't asyncread and asyncwrite work ?
    I hear detours is old, and not necessarily work on all windows os

  6. #6
    Join Date
    Nov 2007
    Posts
    28

    Wink Re: How to record mouse events on other objects?

    Quote Originally Posted by Voominibear
    wm_ windows message hooking (mouse, keyboard, journalrecord...)

    via what you describe, doesn't asyncread and asyncwrite work ?
    No, it's impossible to do, hooking will work in this case.

  7. #7
    Join Date
    Jul 2008
    Posts
    50

    Re: How to record mouse events on other objects?

    Thanks for all the reply. Really appreciate it. For the message hooking, can you guys recommend me where can I learn more about it? Are there any good books or websites available where I can learn more about hooking?

    Thanks.

    kagohaik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured