Solved

Wait for process to end

Posted on 2004-09-16
8
167 Views
Last Modified: 2010-05-02
Give the hwnd of a window can someone supply me with the code to wait for it to end processing?

Thanks,
0
Comment
Question by:ampapa
8 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 60 total points
ID: 12080048
0
 
LVL 13

Assisted Solution

by:Michael_D
Michael_D earned 60 total points
ID: 12080053
0
 
LVL 8

Author Comment

by:ampapa
ID: 12080587
emoreau, WSH is out as a solution. Thanks.

Michael, this process is already running so the second part of the suggested answer won't work and the first part doesn't seem to. Even though the process stopped process or was hidden, the event never fired.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 7

Accepted Solution

by:
_agj_ earned 70 total points
ID: 12081899
use this:
http://www.mvps.org/access/api/api0004.htm

the only change u need to make to the code is to take off the section running the exe and jus do a:

ret& = WaitForSingleObject(proc.hProcess, INFINITE)
0
 
LVL 8

Author Comment

by:ampapa
ID: 12083153
A couple of questions.

The 'proc' in "WaitForSingleObject(proc.hProcess, INFINITE)" is a HWND? to the process that was started with the shell application is that correct? So they are getting the HWND using 'SHELL', the process that I am using is already running so do I need to identify the HWND and PID of it and then supply it to the 'WaitForSingleObject' function ?
0
 
LVL 3

Assisted Solution

by:aParser
aParser earned 60 total points
ID: 12084410
Karl Peterson's site has a sample with three solutions to shell and wait.
http://www.mvps.org/vb/

Click "Samples" from the menu and then scroll down to the item listed as Shell32.zip
0
 
LVL 8

Author Comment

by:ampapa
ID: 12085528
This process has not been 'shelled' but is currently a running process. So, essentially I want to be able to wait for a process to end given a HWND and or PID.

Thanks,
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

828 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