Solved

Wait for process to end

Posted on 2004-09-16
8
161 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 69

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now