Then you need to keep track of each process as it is created, and since they are being created recursively, a single form-level variable won't do. You will need to either terminate the process that is last in the hierarchy, and make sure that when
it terminates it signals its termination to its parent, and the parent terminates (all the way back up the chain) or keep track of each process in a list and work through the list to termiante each one.
↧