Page 1 of 1

Capture Events from Another (Not PB) Program

Posted: Thu Oct 01, 2009 2:48 pm
by ebs
Hello!

I'm looking for suggestions as to how to capture events such as a button click or menu selection from an application
not written in PB. I don't have the source code for this program.

I've written a simple timer program in PB and I want to do some performance tests on the other program,
timing how long certain operations take. I tried to search the forum, but couldn't get any useful results.

Is there a way to select a button or menu item in the target program and be able to capture when it is clicked?

Thanks,
Eric

Re: Capture Events from Another (Not PB) Program

Posted: Thu Oct 01, 2009 3:10 pm
by netmaestro
On Windows you'd use a WH_CALLWNDPROC or WH_CALLWNDPROCRET hook for that. The first catches the events just before they are processed and the second just after.

There's an example here: http://www.purebasic.fr/english/viewtop ... 90&start=2

Re: Capture Events from Another (Not PB) Program

Posted: Fri Oct 02, 2009 2:25 pm
by ebs
netmaestro,

Thanks for your suggestion and the example.

I see how the window paint messages were captured,
but I'm having a problem figuring out how to apply the
technique to a button or menu click.

Is there an example of this?

Regards,
Eric