Re: Limiting to one instance

Andrew Grant <[email protected]> Tue, 15 Aug 2006 08:01:13 +0100
Newsgroups gmane.games.devel.windows
Message-ID <56C9B4CE640B7044AAF74431F9C963E10BAAF004@tankard.brighton.climax.co.uk>
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: [email protected] 
> [mailto:[email protected]] 
> On Behalf Of Research
> Sent: Monday, August 14, 2006 11:14 PM
> To: [email protected]
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=555
> 

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555