<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Single instance applications in Windows CE</title>
	<atom:link href="http://bitmatic.com/compact-framework/single-instance-applications-in-windows-ce/feed" rel="self" type="application/rss+xml" />
	<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce</link>
	<description>Lean IT-solutions in .NET/C#</description>
	<lastBuildDate>Thu, 17 May 2012 14:52:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Karen Austrin</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-29406</link>
		<dc:creator>Karen Austrin</dc:creator>
		<pubDate>Thu, 17 May 2012 06:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-29406</guid>
		<description>Is Windows CE on the way out? Compared with other OS&#039;s I think they would be better off re-branding it</description>
		<content:encoded><![CDATA[<p>Is Windows CE on the way out? Compared with other OS&#8217;s I think they would be better off re-branding it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Singh</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-23739</link>
		<dc:creator>Singh</dc:creator>
		<pubDate>Thu, 19 Jan 2012 08:45:19 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-23739</guid>
		<description>This is a perfect and simple solution. Thanks Jacob!</description>
		<content:encoded><![CDATA[<p>This is a perfect and simple solution. Thanks Jacob!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bocote</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-14626</link>
		<dc:creator>Bocote</dc:creator>
		<pubDate>Thu, 14 Jul 2011 13:47:18 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-14626</guid>
		<description>Fantastic - Just what I wanted.



I added two additional Functions that suited my application

	public static Boolean IsRunning()
	{
		Boolean IsRunning;
		String name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
		IntPtr mutexHandle = CreateMutex(IntPtr.Zero, true, name);
		long error = Marshal.GetLastWin32Error();
		IsRunning = (error == ERROR_ALREADY_EXISTS);
		ReleaseMutex(mutexHandle);
            
		return (IsRunning);
	}

  

      public static Boolean IsNotRunning()
        {
            return (!IsRunning());
	}</description>
		<content:encoded><![CDATA[<p>Fantastic &#8211; Just what I wanted.</p>
<p>I added two additional Functions that suited my application</p>
<p>	public static Boolean IsRunning()<br />
	{<br />
		Boolean IsRunning;<br />
		String name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;<br />
		IntPtr mutexHandle = CreateMutex(IntPtr.Zero, true, name);<br />
		long error = Marshal.GetLastWin32Error();<br />
		IsRunning = (error == ERROR_ALREADY_EXISTS);<br />
		ReleaseMutex(mutexHandle);</p>
<p>		return (IsRunning);<br />
	}</p>
<p>      public static Boolean IsNotRunning()<br />
        {<br />
            return (!IsRunning());<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Como asegurar una única instancia de una aplicación en Windows CE &#171; JorgeOrtiz&#8217;s Weblog</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-193</link>
		<dc:creator>Como asegurar una única instancia de una aplicación en Windows CE &#171; JorgeOrtiz&#8217;s Weblog</dc:creator>
		<pubDate>Mon, 27 Sep 2010 22:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-193</guid>
		<description>[...] http://bitmatic.com/compact-framework/single-instance-applications-in-windows-ce [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://bitmatic.com/compact-framework/single-instance-applications-in-windows-ce" rel="nofollow">http://bitmatic.com/compact-framework/single-instance-applications-in-windows-ce</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wong Chi Kai Andrew</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-192</link>
		<dc:creator>Wong Chi Kai Andrew</dc:creator>
		<pubDate>Fri, 10 Sep 2010 08:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-192</guid>
		<description>THX! It is work in VB.net CF

Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Reflection

Public Class SingleInstanceApplication

     _
    Public Shared Function CreateMutex(ByVal Attr As IntPtr, ByVal Own As Boolean, ByVal Name As String) As IntPtr

    End Function

     _
    Public Shared Function ReleaseMutex(ByVal hMutex As IntPtr) As Boolean

    End Function

    Const ERROR_ALREADY_EXISTS As Long = 183

    Public Shared Sub Run(ByVal frm As Form)
        Dim name As String = Assembly.GetExecutingAssembly().GetName().Name
        Dim mutexHandle As IntPtr = CreateMutex(IntPtr.Zero, True, name)
        Dim Rerror As Long = Marshal.GetLastWin32Error()

        If (Not Rerror = ERROR_ALREADY_EXISTS) Then
            Application.Run(frm)
        End If

        ReleaseMutex(mutexHandle)


    End Sub


End Class


=========================================================
Execute the Application this way:

Imports System.IO
Imports System.Globalization

Public Class AppStart


    Public Shared Sub Main()

        Try
            SingleInstanceApplication.Run(New FrmLogin())

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub


End Class</description>
		<content:encoded><![CDATA[<p>THX! It is work in VB.net CF</p>
<p>Imports System<br />
Imports System.Windows.Forms<br />
Imports System.Runtime.InteropServices<br />
Imports System.Reflection</p>
<p>Public Class SingleInstanceApplication</p>
<p>     _<br />
    Public Shared Function CreateMutex(ByVal Attr As IntPtr, ByVal Own As Boolean, ByVal Name As String) As IntPtr</p>
<p>    End Function</p>
<p>     _<br />
    Public Shared Function ReleaseMutex(ByVal hMutex As IntPtr) As Boolean</p>
<p>    End Function</p>
<p>    Const ERROR_ALREADY_EXISTS As Long = 183</p>
<p>    Public Shared Sub Run(ByVal frm As Form)<br />
        Dim name As String = Assembly.GetExecutingAssembly().GetName().Name<br />
        Dim mutexHandle As IntPtr = CreateMutex(IntPtr.Zero, True, name)<br />
        Dim Rerror As Long = Marshal.GetLastWin32Error()</p>
<p>        If (Not Rerror = ERROR_ALREADY_EXISTS) Then<br />
            Application.Run(frm)<br />
        End If</p>
<p>        ReleaseMutex(mutexHandle)</p>
<p>    End Sub</p>
<p>End Class</p>
<p>=========================================================<br />
Execute the Application this way:</p>
<p>Imports System.IO<br />
Imports System.Globalization</p>
<p>Public Class AppStart</p>
<p>    Public Shared Sub Main()</p>
<p>        Try<br />
            SingleInstanceApplication.Run(New FrmLogin())</p>
<p>        Catch ex As Exception<br />
            MessageBox.Show(ex.Message)<br />
        End Try</p>
<p>    End Sub</p>
<p>End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: domingo</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-191</link>
		<dc:creator>domingo</dc:creator>
		<pubDate>Fri, 09 Jul 2010 21:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-191</guid>
		<description>I work in VB for Windows Mobile. I translated your code and this is what I have:
Dim Sistema As uso
Dim System.Windows.Forms As uso
Dim System.Runtime.InteropServices As uso
Dim System.Reflection As uso
Dim de As espacioDim Bitmatic As nombres
 Dim clase As estáticoDim
    ( DllImport (&quot; coredll.dll &quot;, SetLastError = verdadero)) público estático externo CreateMutex IntPtr ( IntPtr Attr , bool Propios, cadena Nombre )
    ( DllImport (&quot; coredll.dll &quot;, SetLastError = verdadero)) público estático externo bool ReleaseMutex ( hMutex IntPtr )
    Const ERROR_ALREADY_EXISTS As largo = 183
    Function estático(Formulario As frm) As públicoEjecutar As vacío
     Dim name As cadena = Assembly.GetExecutingAssembly (). getName () . Nombre
     Dim mutexHandle As IntPtr = CreateMutex ( IntPtr.Zero , verdadero, Nombre)
     Dim error As largo = Marshal.GetLastWin32Error ()
     Dim (Error As siDim ERROR_ALREADY_EXISTS As Not  = ) Application.Run (frm )
     ReleaseMutex ( mutexHandle )

 End Function
************************************************
It does not work. Please can you tell me am I doing wrong?</description>
		<content:encoded><![CDATA[<p>I work in VB for Windows Mobile. I translated your code and this is what I have:<br />
Dim Sistema As uso<br />
Dim System.Windows.Forms As uso<br />
Dim System.Runtime.InteropServices As uso<br />
Dim System.Reflection As uso<br />
Dim de As espacioDim Bitmatic As nombres<br />
 Dim clase As estáticoDim<br />
    ( DllImport (&#8221; coredll.dll &#8220;, SetLastError = verdadero)) público estático externo CreateMutex IntPtr ( IntPtr Attr , bool Propios, cadena Nombre )<br />
    ( DllImport (&#8221; coredll.dll &#8220;, SetLastError = verdadero)) público estático externo bool ReleaseMutex ( hMutex IntPtr )<br />
    Const ERROR_ALREADY_EXISTS As largo = 183<br />
    Function estático(Formulario As frm) As públicoEjecutar As vacío<br />
     Dim name As cadena = Assembly.GetExecutingAssembly (). getName () . Nombre<br />
     Dim mutexHandle As IntPtr = CreateMutex ( IntPtr.Zero , verdadero, Nombre)<br />
     Dim error As largo = Marshal.GetLastWin32Error ()<br />
     Dim (Error As siDim ERROR_ALREADY_EXISTS As Not  = ) Application.Run (frm )<br />
     ReleaseMutex ( mutexHandle )</p>
<p> End Function<br />
************************************************<br />
It does not work. Please can you tell me am I doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alden</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-190</link>
		<dc:creator>Alden</dc:creator>
		<pubDate>Mon, 24 May 2010 12:25:06 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-190</guid>
		<description>It works perfect.Thanks a lot!</description>
		<content:encoded><![CDATA[<p>It works perfect.Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-189</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Wed, 19 May 2010 15:29:41 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-189</guid>
		<description>This worked great!  Thanks.

Do you know of a way to set focus back to the running app instead of just exiting (if the application is minimized for example).</description>
		<content:encoded><![CDATA[<p>This worked great!  Thanks.</p>
<p>Do you know of a way to set focus back to the running app instead of just exiting (if the application is minimized for example).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mary</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-188</link>
		<dc:creator>Mary</dc:creator>
		<pubDate>Thu, 06 May 2010 09:45:19 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-188</guid>
		<description>Very useful. I am going to try this now. IF there is any problem, I will contact you.</description>
		<content:encoded><![CDATA[<p>Very useful. I am going to try this now. IF there is any problem, I will contact you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://bitmatic.com/c/single-instance-applications-in-windows-ce/comment-page-1#comment-187</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Fri, 12 Mar 2010 13:37:17 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=370#comment-187</guid>
		<description>I was heading down the route of adding and deleting values to the Win32 API atom table and checking all references for any atoms that exist are still running. This is a much simpler and more elegant solution!

Saved me a lot of time, thanks!</description>
		<content:encoded><![CDATA[<p>I was heading down the route of adding and deleting values to the Win32 API atom table and checking all references for any atoms that exist are still running. This is a much simpler and more elegant solution!</p>
<p>Saved me a lot of time, thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

