Link to home
Start Free TrialLog in
Avatar of chuck_rothman
chuck_rothman

asked on

How to capture window display events in VB

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.

Chuck Rothman
Avatar of makman
makman

Hi Chuck,
It seems u need a process control to know the applications running in your pc and then.Stop the specified application.
Well the following code will give you the list of Procees in your Pc from which you can again code to stop the proceess you dont want.

*** code removed at the request of its author by Netminder, Site Admin ***
*** to view the code please see the link below ***

Please go through the link to know more:
http://www.mvps.org/vbnet/index.html?http://www.mvps.org/vbnet/api/_func/metht.htm
Regards,
Makman
Avatar of chuck_rothman

ASKER

Thanks for your reply. however, I think you mis-understood me. I don't want to kill the application. All I want to do is close the dialog box.

I need capture all of the window creation events, check the window titles and text, and close the dialogs I want by sending mouseclick events to the Ok or cancel buttons. I know how to send the events if I have the window handle, but I don't know how to monitor the event stack to capture all of the window creation events.

Hi chuck_rothman,
This old question (QID 20560478) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of AnnieMod
AnnieMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial