Try ShellExecuteEx
instead, which can return a HANDLE hProcess
of the newly-started process.
When/if you have a HANDLE hProcess
then I expect you can pass it as a parameter it to the TerminateProcess
function: which you would call (to terminate the child process) before your application stops.