Capturing and calling Windows events

Does anyone know how to intercept events generated from clicking a button on a Windows program, such that I could call that event within my own program?

For example, in Dragon's NaturallySpeaking, I want to be able to quickly turn on and off the NaturallySpeaking program to allow my speech recognition program to be ran whenever I want or don't want. To do this requires clicking on the Dragon's NaturallySpeaking icon in the system tray bar; I was wondering if I could intercept the event generated by that clicking and then call it at will.
Have a look at 'autohotkey' at www.autohotkey.com. It's free and imbeds itself into the windows keyboard events. Very versatile and might do what you want.
autohotkey has nothing to do here (not programming)
Just use Hooks
Hooks has nothing to do with that, a simple SendMessage() i think is enough after you get the window handle.
Just use Spy++ to find out which message need to be sended.
@ george135: Please enlighten us on how one would go about using a hook in this venture? I know that we are sometimes vague on this site but I've seen you take it to extreames with some of your posts and I'm wondering if you aren't over complicating things for this user due to a lack of understanding toward their problem.

That 'autohotkey' thing looks like a macro writer for script kiddies. Although I disagree with using that tool itself I think the idea is sound. A macro would be the most efficent solution here. Otherwise what ever you do starts another process in memory that sits idle more then half the time the PC is on just so that it can watch for a specific key combo. Let us know what platform you're using and I'll post a link on how to write the macro.
Last edited on
> Hooks has nothing to do with that, a simple SendMessage()

"intercepting events" is done by hooks
Spy++ use hooks...
Last edited on
Topic archived. No new replies allowed.