PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework how to allow only one instance of an application?

Reply

how to allow only one instance of an application?

 
Thread Tools Rate Thread
Old 26-11-2004, 01:23 AM   #1
assaf
Guest
 
Posts: n/a
Default how to allow only one instance of an application?


hi all

i want to block my users
from running more then
one instance of my app
on their machine.

how can i block my users from running more
then one instance of my app on their machines?


assaf



  Reply With Quote
Old 26-11-2004, 03:55 AM   #2
CiccioPalla
Guest
 
Posts: n/a
Default Re: how to allow only one instance of an application?

bool isFirstInstance = true;

Mutex mutex = new Mutex(true ,"INSTANCECHECK", out isFirstInstance );

if (!isFirstInstance)
{
MessageBox.Show("Another instance is running");
//...
}
//...

(you can change "INSTANCECHECK" to what you want...)


"assaf" <assafwo@hotmail.com> ha scritto nel messaggio
news:urm5#K10EHA.3108@TK2MSFTNGP12.phx.gbl...
> hi all
>
> i want to block my users
> from running more then
> one instance of my app
> on their machine.
>
> how can i block my users from running more
> then one instance of my app on their machines?
>
>
> assaf
>
>
>



  Reply With Quote
Old 26-11-2004, 06:15 AM   #3
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
Default Re: how to allow only one instance of an application?

assaf <assafwo@hotmail.com> wrote:
> i want to block my users
> from running more then
> one instance of my app
> on their machine.
>
> how can i block my users from running more
> then one instance of my app on their machines?


See http://www.pobox.com/~skeet/csharp/...cation.instance

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off