Capture Events from Another (Not PB) Program

Everything else that doesn't fall into one of the other PB categories.
ebs
Enthusiast
Enthusiast
Posts: 567
Joined: Fri Apr 25, 2003 11:08 pm

Capture Events from Another (Not PB) Program

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Capture Events from Another (Not PB) Program

Post 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
BERESHEIT
ebs
Enthusiast
Enthusiast
Posts: 567
Joined: Fri Apr 25, 2003 11:08 pm

Re: Capture Events from Another (Not PB) Program

Post 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
Post Reply