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

x
?
Solved

process problem

Posted on 1998-10-14
9
Medium Priority
?
646 Views
Last Modified: 2012-06-27
Hi all!

I have a probelm with processes
I use CreateProcess to start the new process then I use WaitForSingleObject to wait for it to end. Now the problem is that this new (2nd) process also creates process (3rd).
What happens is that 2nd is terminated before 3rd, and this one seems to just hang around in memory.

the 2nd process is a program which I have no control over, some one else wrote it.

so the main question is:
how can I make sure that all subprocesses are finished before I terminate the 2nd process?
0
Comment
Question by:M031097
[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
9 Comments
 

Expert Comment

by:jbalagop
ID: 1175129
The above was a comment. also if you want to read from the port,
once you have created the the file using CreateFile(), it returns the handle to this communication device. You may read or write then. Also, make sure you have status checking on the port (incase the connection is reset).


0
 
LVL 86

Expert Comment

by:jkr
ID: 1175130
Is the 3rd process a GUI application or a console process?
0
 

Expert Comment

by:clance
ID: 1175131
Did you write the 3rd program?  Please explain what type of program it is (console app, Win 32 app, MFC app, etc.), what it's doing, and why you would want to kill it in the middle of whatever it's doing.

I'm thinking that if it's a Windows app of come kind you can send the 3rd process a WM_CLOSE message based on it's main window's title.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:clance
ID: 1175132
Did you write the 3rd program?  Please explain what type of program it is (console app, Win 32 app, MFC app, etc.), what it's doing, and why you would want to kill it in the middle of whatever it's doing.

I'm thinking that if it's a Windows app of come kind you can send the 3rd process a WM_CLOSE message based on it's main window's title.
0
 
LVL 1

Expert Comment

by:msa092298
ID: 1175133
dwCreationFlags should contain CREATE_NEW_PROCESS_GROUP

0
 

Author Comment

by:M031097
ID: 1175134
the first program is the only one I have created, the 2nd could basically be anything, the 3rd is a GUI app and these dialogs are still showing while the other two programs are terminated.
CREATE_NEW_PROCESS_GROUP is used but doesn't work.

0
 

Expert Comment

by:clance
ID: 1175135
CREATE_NEW_PROCESS_GROUP is a hold over from UNIX and is only supported for Console Apps.
0
 
LVL 2

Accepted Solution

by:
mnguyen021997 earned 450 total points
ID: 1175136
try using createprocess with the debug_process flag which essentially makes you a debugger of the process created.  it also gives you notification of other process that are spawned by the debugged process. these notifications should be sufficient to allow you to track the lifetime of these processes.
0
 

Author Comment

by:M031097
ID: 1175137
I haven't had time to try this, but I will accept your answer anyway. Not your fault the boss is stealing time from me ;-)
thanks all
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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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.

721 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