all groups > dotnet compact framework > february 2007 >
You're in the

dotnet compact framework

group:

Detecting multiple instances of an application



Detecting multiple instances of an application Kevin
2/28/2007 11:52:22 AM
dotnet compact framework: 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,
Re: Detecting multiple instances of an application Paul G. Tobey [eMVP]
2/28/2007 1:04:08 PM
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/microsoft.public.dotnet.framework.compactframework/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.

[quoted text, click to view]

AddThis Social Bookmark Button