Re: Limiting to one instance

"Jason Sandlin" <[email protected]> Tue, 15 Aug 2006 02:26:46 -0700
Newsgroups gmane.games.devel.windows
Message-ID <54ABF245FC03174D88151876AC8C98C9022C3F9E@RED-MSG-70.redmond.corp.microsoft.com>
Ya and if a parent (the administrator) has setup Windows Vista time limits =
on computer usage for a child account (a standard user), the child account =
will be fast user switched out when their computer time slot is up.  The ga=
me & other apps will continue to run in the background however but the user=
 won't be able to log back in until the potentially the next day.  In theor=
y there could be a case where a 2nd user could log in and want to play the =
same game after this happened.  It's kinda a corner case, but possible...

Jason

-----Original Message-----
From: [email protected] [mailto:gamedevlis=
[email protected]] On Behalf Of Dirk Ringe
Sent: Tuesday, August 15, 2006 1:22 AM
To: Alen Ladavac; Game Development for MS Windows; Andrew Grant
Subject: Re: [GD-Windows] Limiting to one instance

One thing to keep in mind when using global objects in windows is Fast User=
 Switching in Windows XP, where in fact multiple users are logged in at the=
 same time. When you use CreateMutex you block the application from running=
 under ALL other user accounts as well. This could as well apply to FindWin=
dow. If you do not want this to happen, you have to use a technique which i=
s per user, like the old unix style pid file stored under the users home di=
rectory.

Dirk

-----Urspr=FCngliche Nachricht-----
Von: [email protected] [mailto:gamedevlist=
[email protected]] Im Auftrag von Alen Ladavac
Gesendet: Dienstag, 15. August 2006 10:13
An: Andrew Grant
Cc: Game Development for MS Windows
Betreff: Re: [GD-Windows] Limiting to one instance

> 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!

Actually, it's not such a weird idea. Some applications rely on IP ports as=
 a simple yet very portable IPC mechanism. Firewalls should really know bet=
ter, by handling 127.0.0.1 specifically by default. But apparently even the=
 best in class don't.

Btw, in my book, even using a named mutex in that way is a bit hacky becaus=
e you are relying on error. But what can we do, when there's no real API in=
tended for that purpose.

Personally, I've been using FindWindow(xyz, NULL) to find a main window by =
class name. Same principle (with same weaknesses as a named mutex), but doe=
sn't require an extra object creation, as you probably already have a windo=
w, and you can use this to test even for foreign applications, because it d=
oesn't require access to the code of the tested application. A nice side ef=
fect is that once you have the window, you can report messages like "Cannot=
 start, please close ABCD application first", where you get the ABCD from t=
he application's main window caption.

Cheers,
Alen


-------------------------------------------------------------------------
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 easi=
er Download IBM WebSphere Application Server v.1.0.1 based on Apache Geroni=
mo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=3D555



-------------------------------------------------------------------------
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 easi=
er Download IBM WebSphere Application Server v.1.0.1 based on Apache Geroni=
mo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=3D555

-------------------------------------------------------------------------
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 easi=
er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=3D555