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



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.


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



Take a look:


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?





All Articles