Solved

Wait for process to end

Posted on 2004-09-16
8
160 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
Comment Utility
0
 
LVL 13

Assisted Solution

by:Michael_D
Michael_D earned 60 total points
Comment Utility
0
 
LVL 8

Author Comment

by:ampapa
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 7

Accepted Solution

by:
_agj_ earned 70 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now