<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Samuel Haddad &#187; Mutex</title> <atom:link href="http://samuelhaddad.com/tag/mutex/feed/" rel="self" type="application/rss+xml" /><link>http://samuelhaddad.com</link> <description></description> <lastBuildDate>Thu, 03 Nov 2011 16:32:38 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Creating a Single Instance C# Application</title><link>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/</link> <comments>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/#comments</comments> <pubDate>Wed, 20 May 2009 00:51:13 +0000</pubDate> <dc:creator>Samuel Haddad</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[C#]]></category> <category><![CDATA[Mutex]]></category> <category><![CDATA[Single Instance]]></category> <category><![CDATA[Visual Studio]]></category> <guid
isPermaLink="false">http://samuelhaddad.com/?p=385</guid> <description><![CDATA[This is something I find myself looking up alot so I decided to put it into a post for easy access, and for anyone else who might be looking for a solution. Download Single Instance Application Source Code I still don&#8217;t get why in Visual Studio in VB.NET one could click make single instance application, [...]]]></description> <content:encoded><![CDATA[<p>This is something I find myself looking up alot so I decided to put it into a post for easy access, and for anyone else who might be looking for a solution.</p><pre class="brush: csharp; title: ; notranslate">using System.Threading;</pre><pre class="brush: csharp; title: ; notranslate">
    static class Program
    {
        /// &lt;summary&gt;
        /// The main entry point for the application.
        /// &lt;/summary&gt;
        [STAThread]
        static void Main()
        { 
            bool createdNew = true;
            using (Mutex mutex = new Mutex(true, &quot;SignleInstance&quot;, out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1());
                }
            }
        }
    }
</pre><p><a
href='http://samuelhaddad.com/wp-content/uploads/2009/05/singleinstance.zip'>Download Single Instance Application Source Code</a></p><p>I still don&#8217;t get why in Visual Studio in VB.NET one could click make single instance application, but that same feature doesn&#8217;t exist in C#? Don&#8217;t all .NET languages just get compiled to the CIL in the end?</p> ]]></content:encoded> <wfw:commentRss>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
