Solved

Spawning Win32 apps and waiting for completion

Posted on 1999-01-08
4
235 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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Would it be possible to get an example?  Meanwhile I'll start reading about the above-mentioned items.
0
 

Author Comment

by:mbishop
Comment Utility
Could I get an example?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

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

10 Experts available now in Live!

Get 1:1 Help Now