Detecting multiple instances of an application

K

Kevin

I've searched the Internet (and will keep searching) for a way to determine
if my application is already running and to keep it from starting a second
instance.

1. Using Visual C#.NET (VS2003).
2. Compact Framework 1.1.
3. Pocket PC 2003.
4. Windows CE 4.2

I've found ways to do it through Visual Basic, CF 2.0, C++, but not C#. I
know there has to be a way, but I just can't find it. Any help is
appreciated.

Thanks,
Kevin
 
P

Paul G. Tobey [eMVP]

Have you searched the archives of this group? It's been covered here a
number of times before. Here's a link to start the search:

http://groups.google.com/group/micr...ork/topics?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8

Basically the canonical answer is to create a named mutex on startup and, if
it already exists, there's another instance of your program running, so you
exit silently. I think that CreateMutex() is wrapped by some segment of
OpenNETCF's Smart Device Framework source.

By the way, there's no such thing as Compact Framework 1.1.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top