stop multi instantes of program on one machine

  • Thread starter Thread starter id10t error
  • Start date Start date
I

id10t error

Hi,

I am sorry that my description is not better but it is hard to think
of one for this problem. I have a program on the user computer and I
need to only let them have one instants of this program open at one
time. Is there a way to check to see if the program in already running
and not let them open it?

Thank you in advance for your help.
 
Hi,

I am sorry that my description is not better but it is hard to think
of one for this problem. I have a program on the user computer and I
need to only let them have one instants of this program open at one
time. Is there a way to check to see if the program in already running
and not let them open it?

Thank you in advance for your help.

There is a setting on the application's property pages called "Single
Instance Application" or something similar - you should check that
option.

Thanks,

Seth Rowe [MVP]
 
There is a setting on the application's property pages called "Single
Instance Application" or something similar - you should check that
option.

Thanks,

Seth Rowe [MVP]

Seth,

That worked great. Thank you for your help
 
Hi,
You can also check this out:
http://www.bobpowell.net/singleinstance.htm

or it can be done by querying application's current entity using
process class.

Thanks,

Onur

Another process name method... I always try to warn people off of this
method. It's just as easy to use a mutex and less dangerous. I know
the chance is small - but process names are not necessarily unique.
There is nothing stopping me from creating an application names
notepad.exe. If I were to use this method, then if the user starts the
real notepad, they can't start mine. I know that's extreme and
contrived - but, it isn't an impossible situation. Using a named mutex,
is generally a safer way to go.
 
Another process name method... I always try to warn people off of this
method. It's just as easy to use a mutex and less dangerous. I know
the chance is small - but process names are not necessarily unique.
There is nothing stopping me from creating an application names
notepad.exe. If I were to use this method, then if the user starts the
real notepad, they can't start mine. I know that's extreme and
contrived - but, it isn't an impossible situation. Using a named mutex,
is generally a safer way to go.

Tom,
That's a good point, blocking an application by its name can cause
conflicts with the applications that have the same name, though it's
not common but possible as you stated.

Also another point might be, the user can start application by
changing application name before launch, so this way(GetProcessByname)
won't avoid your application to be executed more than once by a
clever user.

Thanks :)

Onur
 
kimiraikkonen said:
Tom,
That's a good point, blocking an application by its name can cause
conflicts with the applications that have the same name, though it's
not common but possible as you stated.

Also another point might be, the user can start application by
changing application name before launch, so this way(GetProcessByname)
won't avoid your application to be executed more than once by a
clever user.

Thanks :)

Onur



Onur

If you would have clicked on my example ( the second link that is
Terminal server capable ) you would have seen that there is a simple
solution for that problem
instead of creating a mutex by name you create one by application GUID


HTH

Michel
 
Here we have one catch. Checking the Checkbox of single instance would work
fine for Single login machine. In case of machines (OS) where multiple user
can login at same time, this won't work. This checkbox setting works for
that that login. If other user login on same machine, then there is
possiblity that second instance can start of same application.

Thanks,
Mayur H Chauhan
 
Back
Top