-
May 26th, 2006, 05:29 AM
#1
Single instance app and multi logons
Hi all,
I have a single instance application which is started automatically
on user logons.
Single instance is maintained using a global mutex lock.
Now the problem i m facing when running on multi logon machines is as follows.
UserA logs in --> single.exe is started
UserB logs in --> single.exe detects another instance and exits.
UserA logs out --> running single.exe exits.
Now there is no instance of single.exe is running on that computer.
I can not make this program a windows service since it should be
running as any logged on user as owner.
Do you have any ideas to solve this problem ?
Cheers
-
May 26th, 2006, 04:38 PM
#2
Re: Single instance app and multi logons
Simple solution...incorporate the user name into the mutex unique name...
-
May 26th, 2006, 06:41 PM
#3
Re: Single instance app and multi logons
(Since you mentioned multi logon, this should work for you - Local\ prefix on mutex name) But...
What OS targets are you targeting?
Is it XP and newer only?
Because I believe XP uses terminal services to implement fast user switching.
If that is the case:
Originally Posted by MSDN
The name can have a "Global\" or "Local\" prefix to explicitly create the object in the global or session name space
http://msdn.microsoft.com/library/de...reatemutex.asp
However...
Originally Posted by MSDN
Windows 2000: If Terminal Services is not running, the "Global\" and "Local\" prefixes are ignored. The remainder of the name can contain any character except the backslash character.
-
May 27th, 2006, 06:27 AM
#4
Re: Single instance app and multi logons
Thanks for the suggestions.
But that does not completely solve my problem. I can not run multiple instances in any case.
In the suggested method each user will have one instance of the app running right ?
Or may be I did not understand.
Cheers
-
May 27th, 2006, 07:57 AM
#5
Re: Single instance app and multi logons
Originally Posted by JamesSchumacher
What OS targets are you targeting?
Well...if he is running Windows 2000, he wouldn't have any problems since Windows 2000 didn't implement fast user switching...
-
May 27th, 2006, 07:58 AM
#6
Re: Single instance app and multi logons
Originally Posted by aneesh.joy
But that does not completely solve my problem. I can not run multiple instances in any case.
Well...then I don't understand the problem in the first place. If you always run only one instance the method you are using (creating a unique mutex) is fine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|