Jump to content
  • Advertisement
Sign in to follow this  
BriTeg

Preventing multiple instances of an app

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

Recently there was some good info in here about preventing multiple instances of an app, and specifically why "FindWindow" wasn't the best solution. I can't find that info again, and the search function is disabled. Does anyone know what I'm looking for? Thanks, Brian

Share this post


Link to post
Share on other sites
Advertisement
The method propagated by Microsoft seems to be mutexes... that is... basically, when you start the application, you create the mutex... call GetLastError and if you get MUTEX_ALREADY_EXISTS (or something like that) the application is already running.

Gonna see if I can find their article.

"If you need to detect whether another instance already exists, create a uniquely named mutex using the CreateMutex function. CreateMutex will succeed even if the mutex already exists, but the function will return ERROR_ALREADY_EXISTS. This indicates that another instance of your application exists, because it created the mutex first."

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!