Process Group question
Posted on 2000-01-26
I have an MFC based (gui) app, that creates anonymous pipes to a console app that it communicates with. I have to be able to kill off the console app from the MFC app if the console app gets hung. This works fine if I communicate directly with the console app, because I can call TerminateProcess() to kill it off if need be. However, I need to implement support for a console app that has a pre-processing front-end app. Basically, this pre-processing app parses through the work load, and determines the proper console app to start up to process the work load. So I need to do this: use CreateProcess() to execute the pre-processing app (which is a console app as well), and that process in turn executes another process. HOWEVER, if I kill off the pre-processing app, it leaves the workload-processing console app hanging around in the background. Is there a way to kill off the pre-processing app along with any child processes? The concept I'm talking about here is a process group. I tried using CreateProcess() with the CREATE_NEW_PROCESS_GROUP flag, and then using GenerateConsoleCtrlEvent() to send a CTRL_BREAK event to the pre-processing app, but it doesn't work for me. Any ideas?