Solved

WaitForSingleObject returns WAIT_OBJECT_0

Posted on 1998-02-21
3
2,801 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert filename column as column a 18 76
Example of WebAPI 7 33
Why I am having this error installing Visual Basic Enterprise 11 59
Need to impress with my knowledge of .NET 5 89
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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