Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Spawning Win32 apps and waiting for completion

Posted on 1999-01-08
4
Medium Priority
?
243 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 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

722 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