Skip to content

Commit

Permalink
Only allow one instance of WinHideEx to run at a given time
Browse files Browse the repository at this point in the history
  • Loading branch information
joshumax committed Sep 13, 2022
1 parent 8266c9a commit 6896b32
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions WinHideExGUI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
using System;
using System.Threading;
using System.Windows.Forms;
using WinHideExGUI.Properties;

namespace WinHideExGUI
{
static class Program
{
// Our mutex
private static Mutex mutex = null;

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
mutex = new Mutex(true, Resources.AppName, out bool createdNew);

if (!createdNew)
{
MessageBox.Show("Another instance of the application is already running!");
return;
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CustomApplicationContext(new MainForm()));
Expand Down

0 comments on commit 6896b32

Please sign in to comment.