Results 1 to 4 of 4

Thread: Listen for button click

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    126

    Listen for button click

    Hi,

    Is it possible to somehow listen (from VB code) if a button on some other application (not made by me) has been clicked? Probably with API functions? I suspect that maybe GetMessage could do it? Very grateful for help!

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Listen for button click

    No, GetMessage retrieves a message from the calling thread, which means that it can only get messages from your own application.

    To be able to listen to messages sent to a window or control you would need to subclass it. However VB itself doesn't allow subclassing of external programs, the simple reason for that is because such a callback function needs to exist in a regular DLL and you can't create on of those in VB, you'll need to use another language to be able to do that. However once you have a DLL that can do that you can use that from VB.

    There is a couple of examples in the Code Bank, search for subclassing external application.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    126

    Re: Listen for button click

    OK thanks Joacim...I have asked the question on the API forum too, and I got some code there to use...so I'll maybe try that later.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Listen for button click

    <Went away to the API forum>

    Yes, that's the two subclassing examples I mentioned above.

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