In myApplication.exe I call ShellExecute
to start another process, let's say OtherApplication.exe.
In OtherApplication.exe, I'm noticing that it is failing to spawn it's own processes, for example cmd.exe to do some tasks.
If I run OtherApplication.exe from Windows Explorer (not from myApplication.exe) everything in OtherApplication.exe runs as expected.
I looked in Process Explorer and observed the following in the process tree:
- Explorer.exe
- myApplication.exe
- OtherApplication.exe [this isn't working]
- OtherApplication.exe [this is working]
- myApplication.exe
So I guess my question is can I start a child process from myApplication.exe that doesn't show it as the parent? I couldn't think of any other reason why OtherApplication.exe would be behaving differently if I run it myself from Windows Explorer or from another app use ShellExecute
.
I get the same result if I use something like from myApplication.exe:
ShellExecute(0, nil, 'cmd.exe', PWideChar('/C "' + '"C:\...somepaths...\OtherApplication.exe"'), nil, SW_HIDE);
then cmd.exe is a child of myApplication.exe. Its process children include conhost.exe and OtherApplication.exe. Which still doesn't behave the same as the explorer.exe process.