title: How to run a process with ShellExecuteEx as as a child that closes after parent exit?
body: <p>I need to spawn a process which need to invoke UAC. I have read this post: <a href="https://stackoverflow.com/questions/4893262/how-can-i-run-a-child-process-that-requires-elevation-and-wait">How can I run a child process that requires elevation and wait?</a>.</p>
  
  <p>Unfortunatelly I can't run a process as a <em>real</em> child. The new process run as a separate and continue to run even after spawner close. But I need it to close automatically when parent exits (normal exit or by crash or any other reason).</p>
  
  <p>One of the solution that were provided is to use jobs for that. Unfortunately I can't assign a process created with <code>ShellExecuteEx</code> to a job. It returns me an error <code>ERROR_ACCESS_DENIED</code>. To handle this I have to pass <code>CREATE_BREAKAWAY_FROM_JOB</code> to <code>CreateProcess</code>. And this is the closed circle. I have to use <code>ShellExecuteEx</code> but not <code>CreateProcess</code>.</p>