Question about Windows messaging and this Mutex example

In this demo shown here:

http://sanity-free.org/143/csharp_dotnet_single_instance_application.html

the program uses a Mutex to prevent multiple instance from opening.  It uses Windows messaging.  Does the first instance send a message and the second instance read that message, then exits?

If so where does the first instance remove that message upon exit?

Does it use the GUID to identify the message?

newbieweb
newbiewebSr. Software EngineerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mac-willConnect With a Mentor Commented:
There is a system Mutex. The first thing the app does is check if this Mutex is available (i.e. no other app is running)
The GUID is simply the string name of the named Mutex.

The second thing it does is broadcast a custom windows message to all windows.  The running application see's this custom message and brings itself on top of all the other windows.

The GUID has nothing to do with the Windows message.

MAC
0
 
newbiewebSr. Software EngineerAuthor Commented:
I see this line removed the lock after completion of execution.

mutex.ReleaseMutex();
 
0
 
vimalalexCommented:
Hi newbieweb,
                     Are you looking to restrict your application by one instance.

Thanks & Regards,
Vimal
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
vimalalexCommented:
Hi newbieweb,
         Go through this link this may help u
http://www.codeproject.com/KB/cs/singleinstance.aspx

Thanks & Regards,
Vimal
0
 
newbiewebSr. Software EngineerAuthor Commented:
I am specifically trying to understand this demo so I can understand usiong a Mutex.  I am not trying to make my program run a single instance.  It does that using System.Diagnostics.Process and I am okay with that.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks.
0
All Courses

From novice to tech pro — start learning today.