Solved

WaitForSingleObject returns WAIT_OBJECT_0

Posted on 1998-02-21
3
2,784 Views
Last Modified: 2013-12-03
I'm calling CreateProcess(
   tzAppName,
   NULL,
   NULL,
   NULL,
   FALSE,
   0,
   NULL,
   NULL,
   &StartupInfo,
   &ProcessInfo );

and then

WaitForSingleObject( ProcessInfo.hHandle, INFINITE );

CreateProcess returns TRUE, and WaitForSingleObject
returns WAIT_OBJECT_0. Exectution continues
seemingly without pause. Which is bad, because I'm
waiting for the executable module to exit. Help says
WAIT_OBJECT_0 means "The state of the specified
object is signaled."

The app I'm launching is an internal Setup program, for
what that's worth. Anybody know what gives?
0
Comment
Question by:barrett
3 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 1411448
WAIT_OBJECT_0 means that what you were waiting for happened.  Your process finished.  My guess is that your process in not starting properly.  Use the GetExitCodeProcess function to find out what happened to your process and why it died so quickly.
0
 

Expert Comment

by:flfmdll
ID: 1411449
Your new process is exiting with a signaled state. That's a given I suppose. Perhaps your exit or return value is 1 no matter what for this process. You can look into the code to change it. Something is not working in your new process, returning, and making your WaitForSingleObject think it is okay to continue. It seems your code for spawning it is okay.
0
 

Author Comment

by:barrett
ID: 1411450
As it turns out, the exe I was spawning was just a stub that launched another process. Once I got the name of the other mutex, everything was fine. Thanks for answering...
0

Featured Post

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

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 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

20 Experts available now in Live!

Get 1:1 Help Now