How to capture window display events in VB

Posted on 2003-03-23
Medium Priority
Last Modified: 2010-05-01
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
Question by:chuck_rothman

Expert Comment

ID: 8194279
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:

Author Comment

ID: 8196717
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.


Expert Comment

ID: 8531767
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.

Expert Comment

ID: 8958882
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.


EE Cleanup Volunteer

Accepted Solution

AnnieMod earned 0 total points
ID: 9286826
Per recommendation.

Community Support Moderator

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question