Jump to content
  • Advertisement
Sign in to follow this  
sir_wojciech

How to check if an application finished working?

This topic is 4232 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm executing a console application (via ShellExecute). And it does some calculations. How to check if that application finished working (it should return 0 when it finishes)? I'm doing this in c++ on windows (winapi). Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure you can do that with ShellExecute. You can, however, launch an application using CreateProcess and use WaitForSingleObject to wait until it finishes. Take at look at this MSDN link: Creating Processes

Share this post


Link to post
Share on other sites
Yeah, CreateProcess and WaitForSingleObject is the way to go here. ShellExecuteEx doesn't return anything that you can actually work with.

Share this post


Link to post
Share on other sites
That solved the problem, but made a new one. The application I execute (via CreateProcess) writes it's output in my console application (in the one that executed it - parent). How to stop it? (so it doesn't write it's output in parent's process 's console)

Thanks in advance!

Share this post


Link to post
Share on other sites
Check out the documentation for CreateProcess. In the dwCreationFlags parameter, you must set the CREATE_NEW_CONSOLE flag.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!