Jump to content
  • Advertisement
Sign in to follow this  
Z4Gamer

Checking if an exe file is running with c++

This topic is 4910 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

Hi I have two seperate exe files and I am looking for some ideas as to how I can deterimine if the other one is running so I can set the other one to sleep. Any help would be most appreciated :) [Edited by - Z4Gamer on December 15, 2004 7:23:13 AM]

Share this post


Link to post
Share on other sites
Advertisement
You can use CreateMutex() to create a named mutex in one application, and then try to create a mutex with the same name in the other one. If the other application is running, GetLastError() will return ERROR_ALREADY_EXISTS.

Share this post


Link to post
Share on other sites
I am current executing the second file using this

WinExec("Application.exe",SW_SHOWMAXIMIZED);

Is there any other way I can check to see if its running without using Mutex as I have had lots of problems with them in the past :eek:

Share this post


Link to post
Share on other sites
Just thought of something: Use CreateProcess() to start the application, and save the process id, which you can then use with OpenProcess() to see if it's still running. Check MSDN for details.

Share this post


Link to post
Share on other sites
Don't futz around with hidden windows and the like, especially when running a console app. Using a mutex is the way to go.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!