App.xaml.cs
using System.Threading;
namespace AppName
{
public partial class App : Application
{
Mutex mutex;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
string mutexName = "exe";
bool createNew;
mutex = new Mutex(true, mutexName, out createNew);
if (!createNew)
{
Shutdown();
}
}
public App()
{
this.InitializeComponent();
}
}
}
'Programming > C#' 카테고리의 다른 글
Action 사용하기 (0) | 2023.09.27 |
---|---|
현재시간(C#) (0) | 2023.09.05 |
Winform - // form 위에 form 설정 (0) | 2022.07.13 |
기초 C# (0) | 2022.07.13 |
WPF에서 실행파일이 있는 경로 (0) | 2022.07.13 |