Re: [GD-Windows] Limiting to one instance
Brought to you by:
vexxed72
From: Andrew G. <ag...@cl...> - 2006-08-15 07:01:35
|
A named Mutex is the best way to do this. Call CreateMutex with a very unique name, if there's an existing instance then GetLastError returns something like ERROR_EXISTS (I'm sure the exact error is in the CreateMutex documentation). I remember at an old company one genius tried to prevent multiple instances of an app by binding a port, and was then surprised when it failed for pretty much everyone who was running a firewall! A. > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] > On Behalf Of Research > Sent: Monday, August 14, 2006 11:14 PM > To: Gam...@li... > Subject: [GD-Windows] Limiting to one instance > > Is the preferred method of not allowing multiple instances of > a game to run at the same to use named mutexes via > CreateMutex and test for it's exeistence on startup? > > I found an example on MSDN, but it seems targeted at .NET > applications. I'm not sure if there's an easier way to > prevent mutliple launches for a Win32 app. > > Thanks, > Brett Bibby > GameBrains > > > -------------------------------------------------------------- > ----------- > Using Tomcat but need to do more? Need to support web > services, security? > Get stuff done quickly with pre-integrated technology to make > your job easier Download IBM WebSphere Application Server > v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > dat=121642 > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > |