Reputation: 27
I would like to run c# executable file abc.exe at the end of c++ managed project main functionality. abc.exe needs to run asynchronously without disturbing the c++ managed project even it encounter any errors.
I have found that process run .exe async but what if .exe encounter any error will that exe c++ managed project?
Process ^p;
ProcessStartInfo ^pInfo;
pInfo = gcnew ProcessStartInfo();
pInfo->Verb = "open";
pInfo->FileName = "d:\\abc.exe";
pInfo->UseShellExecute = true;
p = Process::Start(pInfo);
Upvotes: 0
Views: 185
Reputation: 1766
abc.exe needs to run asynchronously without disturbing the c++ managed project even it encounter any errors.
Two separate processes will normally not affect each other without explicitly writing code to communicate between each other. If both processes use a shared resource, like hardware or a file, then they can interfere with each other through that shared resource. We would need more details on your C# and C++ projects to tell you whether they can affect each other in that way.
I have found that process run .exe async but what if .exe encounter any error will that exe c++ managed project?
The abc.exe
process will exit and the C++ process will continue to run as if nothing happened. You may implement code to wait for abc.exe
to exit and handle its return value if you wish.
By design, all processes are meant to run asynchronously with their own independent memory. This is how Explorer.exe
can be used to launch programs but does not crash when a program it launched crashes.
Upvotes: 2