Solved

Spawning Win32 apps and waiting for completion

Posted on 1999-01-08
4
242 Views
Last Modified: 2010-04-02
Begining programmer's question:  How do I spawn a Win32 app and wait for it to complete before returning to the parent application, or get the parent to detect completion before continuing?  Any help would be greatly appreciated.
0
Comment
Question by:mbishop
[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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1181784
You will need to use CreateProcess() and with the HANDLE returned, you need to use WaitForSingleObject() to wait until the handle is closed. This happens when the application exits.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1181785
Actually, to be more precise you want to wait for the handle to be SIGNALED not CLOSED.  The handle will still be open by your application and possibly by others.  When you are done waiting (when WaitForSingleObject() returns) remember to close your copy of the handle and also the primary thread handle (this is discussed in the CreateProcess() documentation).
0
 

Author Comment

by:mbishop
ID: 1181786
Would it be possible to get an example?  Meanwhile I'll start reading about the above-mentioned items.
0
 

Author Comment

by:mbishop
ID: 1181787
Could I get an example?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

617 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