I have a EXE1 which requires an Config file when launched.
I am using ShellExecuteEx to launch EXE1 from EXE2.
It is working fine as such but the if the config file is not preset for EXE1 then it do not get launched however ShellExecuteEx returns TRUE(1) .
I am checking the return value of ShellExecuteEx to Disable the “Launch” BUtton in EXE2 which launch the EXE1.
Since ShellExecuteEx returns TRUE(1) so Launch button is Disable which wrong functionality.
I tried this with CreateProcess as well, it also behaves in the same way.
How can I Ensure exe is launched or not.
You would have to signal from the second program into the first program in some way — by using shared memory, mutants, or some other interprocess communication method.
ShellExecuteEx only cares about whether the executable is able to start, not whether it’s able to do what you expected it to.
Alternately, use CreateProcess instead and monitor for the return code of the child process.