Widow
/trunk/Widow/Program.cs |
@@ -1,4 +1,5 @@ |
using System; |
using System.Threading; |
using System.Windows.Forms; |
|
namespace Widow |
@@ -7,6 +8,8 @@ |
{ |
#region Static Fields and Constants |
|
private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid); |
|
private static Form _form; |
|
#endregion |
@@ -29,12 +32,23 @@ |
[STAThread] |
private static void Main() |
{ |
Application.EnableVisualStyles(); |
if (Mutex.WaitOne(TimeSpan.Zero, true)) |
{ |
Application.SetCompatibleTextRenderingDefault(false); |
_form = new MainForm(); |
Application.Run(); |
Mutex.ReleaseMutex(); |
return; |
} |
|
// Foreground current other application window. |
Natives.PostMessage( |
(IntPtr) Natives.HWND_BROADCAST, |
Natives.WM_SHOWME, |
IntPtr.Zero, |
IntPtr.Zero); |
} |
|
#endregion |
} |
} |