Solved

Wait for process to end

Posted on 2004-09-16
8
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

749 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