C # WPF Maintains a separate bootloader instance

I have loader.exe with Main () that loads 'UI' in WPF, the point is I only want one instance of loader.exe, how can I achieve it?

Is there a way the user clicks loader.exe, he has to check if the existing loader.exe is running and not doing anything.

currently I have

loader.exe

from

main() 
....
..
Load UI
...

      

the loader has no idea what its loading, etc., so I can't do much with the loader project ...

Any n support code is highly appreciated

Thanks in advance.

+1


source to share


3 answers


We use the following C # code to determine if the application is running:

using System.Threading;

string appSpecificGuid = "{007400FE-003D-00A5-AFFE-DA62E35CC1F5}";    
bool exclusive;
Mutex m = new Mutex(true, appSpecificGuid, out exclusive);
if (exclusive) {
    // run
} else {
    // already running
}

      



Regards, Tamberg

+2


source


Take a look:

http://yogesh.jagotagroup.com/blog/post/2008/07/03/Ways-of-making-a-WPF-application-Single-Instance.aspx



Also, you can find a more detailed answer in the following post here on StackOverflow:

What is the correct way to create a single instance application?

+2


source


0


source







All Articles