How to capture window display events in VB
Posted on 2003-03-23
I want to write a VB app that sits in the background waiting for other applications to pop up dialogs, then send an event to that dialog box's Ok button to close it. In particular (although I'd like the app to be as generic as possible), I want to be able to automatically close those pesky Outlook XP messages that say another program is trying to access Outlook.
I believe that I need to monitor the message stack, and whenever a window display event arrives, I get the window handle, check the window title and for a control with particular text (such as 'Another program is accessing Outlook'), look for a control (button) with a particular string (such as 'Ok', or 'Cancel'), and send a mouse click event to that control.
What I can't figure out is how to monitor the event stack for other applications from VB.
Any help is appreciated.