I am trying to execute an EXE 'two.exe' from another application 'one.exe' in Delphi XE2 using ShellExecute.
ShellExecute(0, 'open', 'two.exe', nil, nil, SW_NORMAL);
It works perfectly, but whenever I terminate application 'one.exe' (the parent app) from Task Manager's process tab, using the "end process tree" option, the application 'two.exe' also gets terminated.
How can I prevent my ShellExecuted application from getting terminated like this?
Ok, not very nice solution... but tested with success ;o)
ShellExecute(0, 'open', 'cmd',
PChar('/C start "" "' + Application.ExeName + '"'), nil, SW_HIDE);
The first is manually launched... his child with regular shellexecute call... The last one, with the shellexecute + cmd trick...
/C explanation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With