C#/WPF
[WPF] Mutex
딸기우유중독
2024. 4. 17. 11:25
Mutex mutex = null;
private void Duplicate_execution(string mutexName)
{
try
{
mutex = new Mutex(false, mutexName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace + "\n\n" + "Application Exiting…", "Exception thrown");
Application.Current.Shutdown();
}
if (!mutex.WaitOne(0, false))
{
MessageBox.Show($"{mutexName}Service already started.", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
Application.Current.Shutdown();
}
}
protected override void OnStartup(StartupEventArgs e)
{
string applicationName = "DSM";
Duplicate_execution(applicationName);
base.OnStartup(e);
}
https://m.blog.naver.com/beamofhope/70044788973
WPF에서 Mutex 사용하여 중복방지 구현하기
WPF에서 Mutex 사용하여 중복방지 구현하기 프로그램이 중복 실행되는 것을 막는 가장 일반적인...
blog.naver.com
[C#,WPF] 어플리케이션 중복실행 차단
어플리케이션이 중복실행 되지 않도록 막는다
velog.io
728x90