Announcement

Collapse
No announcement yet.

Can an app detect when another app gets a key or click?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can an app detect when another app gets a key or click?

    So, could I write an application which detects that another application has received a mouse click or keystroke? And if so, where would I start?

  • #2
    Came off my on-disk SDK, so I don't have a URL to the online version at msdn, but it will be there
    Hooks

    --------------------------------------------------------------------------------
    A hook is a point in the system message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain types of messages before they reach the target window procedure.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I believe you have to design the two applications with a direct data exchange (DDE) link. I did something like that in the dim and distant past and I believe it worked pretty well. A key stroke or mouse click will only be recognized by the application which has focus and it subsequently performs a DDE link to pass the event to the monitoring application.

      Comment


      • #4
        Sorry, make that "dynamic" data exchange (DDE) although "direct" seems more appropriate to me. Norm

        Comment


        • #5
          Thanks both.

          Hooks suits my requirement better. Here is a link to what I hope is a reliable and definitive MSDN document: http://msdn.microsoft.com/en-us/library/ms997537.aspx

          (added) and this code by Semen looks very promising too! http://www.powerbasic.com/support/pb...highlight=hook

          PS if you happen to follow that MSDN link, note the date written. I have some ground to make up!
          Last edited by Chris Holbrook; 21 Nov 2008, 02:48 PM. Reason: added second link

          Comment


          • #6
            believe you have to design the two applications with a direct data exchange (DDE) link
            If the two applications are cooperating, there are many, many ways for them to talk to each other.. you would not need a hook at all, and DDE is no fun to code (demo in source code forum, search "DDE" in subject).

            Except around here, when "not stated" the default is "of course they are not cooperating, I'm trying to make some $50.00 program work like the $100.00 program, and do it for less than $2,500.00 worth of development time"

            That said, if these ARE cooperating applications... SendMessage sounds promising.

            MCM
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X