Added #4 - only one instance will be allowed to run

This commit is contained in:
Szymon Porwolik
2019-02-28 23:06:38 +01:00
committed by simpo
parent 69f995bd6d
commit f383f3c056
4 changed files with 64 additions and 12 deletions

View File

@@ -0,0 +1,13 @@
// this class just wraps some Win32 stuff that we're going to use for blocking of multiple instances
using System;
using System.Runtime.InteropServices;
internal class NativeMethods
{
public const int HWND_BROADCAST = 0xffff;
public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
[DllImport("user32")]
public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
[DllImport("user32")]
public static extern int RegisterWindowMessage(string message);
}